CFEngine Scheduling Tasks #5476
Replies: 2 comments 1 reply
-
Hi @Rebecca-Dieter-Teamwire :) In your example, you are using time-based classes. These are so-called hard classes, meaning that they are set when the agent wakes up. More specifically, time-based classes are set depending on the system time. This means that the class Using the following command, you can see what classes are set:
By default, the agent runs once every 5 minutes, but this can be configured in cf-execd agent execution schedule. Thus, if you want to make sure the promise will be executed, you should probably use the Hope this helps 😄 |
Beta Was this translation helpful? Give feedback.
-
I'll chime in just to highlight CFEngine hard classes and sys vars are resolved during agent initialization. So, it's the classes that are set during initialization that will be set for the run, classes are not updated every minute during an agent run. This snippet should help to illustrate that:
Running the policy, you can see that the agent started around 9:27 and both before and after a 500s sleep sys.date remained
Also, you may want to consider having CFEngine schedule long running tasks (cron, at, systemd timer, etc ...) rather than manage the execution itself which results in longer agent run times and increases the likelihood of overlapping agent runs. |
Beta Was this translation helpful? Give feedback.
-
Hi,
we are having some interesting behavior with some schedules within our promises.
In one promise we are using the scheduler to execute a script at certain full hours.
First example:
The script seems to finish within a minute
In the second promises we are using the scheduler to execute commands
Second Example:
This currently takes about 5 minutes
When we used the same scheduling as in the first example within the second Example so:
This didn't workout as it should.
Is this cause the scheduler only runs within the first minute of the hour and the commands took to long (over a minute)?
Or does any one have an idea why this behavior is shown?
Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions