Bug 902110 - RFE: support restarting unit on calendertime
RFE: support restarting unit on calendertime
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks: systemd-RFE
  Show dependency treegraph
 
Reported: 2013-01-20 17:25 EST by Jóhann B. Guðmundsson
Modified: 2013-07-25 21:29 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-25 21:29:49 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jóhann B. Guðmundsson 2013-01-20 17:25:36 EST
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 

Restart=On-Date
OnCalendar=

which would support having the service restarted on a specific date/time

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Harald Hoyer 2013-04-10 06:58:41 EDT
Can be solved by:

# cat ServiceRestart@sshd.timer
[Unit]
Description=Restart sshd service every minute

[Timer]
OnCalendar=*-*-* *:*:00

# cat ServiceRestart@.service 
[Unit]
Description=Restart service %I

[Service]
ExecStart=/usr/bin/systemctl restart %I.service
Comment 2 Jóhann B. Guðmundsson 2013-04-10 07:26:53 EDT
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
Comment 3 Lennart Poettering 2013-07-25 21:29:49 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.