[systemd-devel] Have timers fire after boot is complete

"Jóhann B. Guðmundsson" johannbg at gmail.com
Thu Sep 27 05:16:29 PDT 2012


On 09/27/2012 11:56 AM, Christian Seiler wrote:
> Let's say I have a couple of servers lying around, each with different
> services installed. Now I want to distribute a single unit file that is
> always run at the end sending me an email that the system has rebooted
> and sending me all log messages generated in the boot process so I can
> see if everything went correctly. 

If you want to run a script in the very end of everything you simply 
order it after the default target as in

[Unit]
Description=My custom script
After=default.target

[Service]
Type=oneshot
ExecStart=/path/to/my/custom/script

[Install]
WantedBy=default.target

> Obviously, I can add lots and lots of
> different units to After= of that service, but as soon as some other
> service is added to the list, I have to adjust it. Also, the After=
> dependency isn't really correct here: Such a script doesn't
> specifically depend on e.g. After=apache.service (it doesn't really
> care about that) but rather something that should run at a certain
> time, thus the idea of using a timer for this feature. 

Is systemd timer unit not sufficient for that?

JBG


More information about the systemd-devel mailing list