Reputation: 6120
I would like to schedule a service restart during a certain period (schedule).
I have attempted a number of variations but none have been successful. Hoping someone knows what I am doing wrong :
schedule { 'my_sched':
range => '11:00 - 11:20',
period => daily,
repeat => 1,
}
service { 'my_service':
ensure => 'running',
enable => true,
schedule => 'my_sched',
}
If I replace service with exec, it works fine.
If I replace schedule with a file dependency, it works as well.
But service does not work with schedule
Upvotes: 1
Views: 849
Reputation: 15472
It is explained in the docs here that:
Currently, schedules can only be used to stop a resource from being applied; they cannot cause a resource to be applied when it otherwise wouldn’t be, and they cannot accurately specify a time when a resource should run.
And that's the problem ; the service will already be running in your schedule, so Puppet will see that it is running and find there is nothing to do.
Maybe just use cron? I would get Puppet to install a cron job that restarts the service instead.
Upvotes: 3