Red Hat Bugzilla – Bug 902110
RFE: support restarting unit on calendertime
Last modified: 2013-07-25 21:29:49 EDT
Description of problem:
I'm analysing those 38 out of 99 cron jobs that we ship, that are potentially worth migrating to native systemd timers unit when I noticed that one of those cron job is restarting the service on a specific date and given that we have had to do the same @dayjob there are definitely use cases to support this thus I propose we implement something like
which would support having the service restarted on a specific date/time
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Can be solved by:
# cat ServiceRestart@sshd.timer
Description=Restart sshd service every minute
# cat ServiceRestart@.service
Description=Restart service %I
ExecStart=/usr/bin/systemctl restart %I.service
You could also with a script and execute that from cron like having to create two units.
Sorry to say but from my pov view the whole integration of "timer" is not so good both from usability perspective and consistency with units types for this to be useful and consistent for administrators we ought to support simply adding an switch to Restart= followed supporting defining OnCalender= in [service] sections by doing so we a) support what this request is for b) properly can intergrade timer jobs in services without having to result to create a specific timer unit and start "Binding" them and what not to other service
I agree with Harald, what he suggests in #1 is a solution that is "good enough".
We should be very careful with making things like this "too easy", since they actually might cause races where the admin edits a configuration file and the cronjob then restarts the service in the background while the configuration file is only half-written.
it's fine if admins hack things up to make a service restart in fixed intervals, but I am very conservative on making something like this a primary functionality of systemd.
Sorry, I am not convinced that adding this would be a good idea, hence closing.