[systemd-devel] Automatic Reboot Protocol

Colin Guthrie gmane at colin.guthr.ie
Tue May 28 02:06:51 PDT 2013


'Twas brillig, and systemdkiosk at yopmail.com at 26/05/13 06:29 did gyre
and gimble:
> Jan Alexander Steffens,
> 
> So in this timer, where/how apply reboot.target,
> or else tell systemd to invoke? Thx
> 
> ----------------------------------------------
> # /etc/systemd/system/nightjanitor.timer
> [Unit]
> Description=Nightly wee-hours heartbeat
> 
> [Timer]
> OnCalendar=*-*-* 01:23:45
> Unit=nightjanitor.service
> 
> [Install]
> WantedBy=multi-user.target
> 
> ----------------------------------------------
> # /etc/systemd/system/nightjanitor.service
> [Unit]
> Description=Nightly chores
> 
> [Service]
> Type=simple
> ExecStart=/etc/systemd/system/nightjanitor.sh
> 
> ----------------------------------------------
> #!/usr/bin/env bash
> # /etc/systemd/system/nightjanitor.sh
> 
> set -e
> 
> # do system stuff like backup
> # and house-clean generally,
> # then REBOOT as final step

Normally calling systemctl in a script is fine, but if you call
systemctl in a script as triggered by another unit it will typically
wait for the job to complete. If the job cannot complete due to waiting
for the job

Perhaps use of the "systemctl --no-block start reboot.target" would work
and allow your unit to exit happily and thus not block?

Col






-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list