[systemd-devel] doing something as the last activity on boot

Lennart Poettering lennart at poettering.net
Fri Mar 22 18:00:57 PDT 2013

On Mon, 18.03.13 09:49, Britton Kerin (britton.kerin at gmail.com) wrote:

> Hi everyone, I just had my first encounter with systemd and all in all I'm
> highly impressed.
> One thing saddened me a bit though: its not obvious what to do if I just want
> to start a service or do something *after* all the stuff that shipped with ths
> OS has happened and the system is fully operational.  I found some email from
> long ago stating that systemd devs thought this would not be a sane feature to
> provide, I don't know if that's true but if it is I don't understand the logic.
> Whenever I have to go into init systems I always want exactly that.  And its
> always surprisingly painful.  This is the #1 use outside of OS devel. context
> that the init system is going to see, so it seems to me that is should be
> supported, and probably be the first thing in the manual as well.

Colin already said most of what I would say. But one addition. Normal
services tend to be ordered before multi-user.target and
graphical.target, so you could add your unit to these targets too, but
order them explicitly *after* the targets, rather then the implied
before. Just use "After=multi-user.target graphical.target". Note
however that actually doesn't really put something "last". It just puts
something after all normal services are running, and if there are many
units like that then they will run in parallel.

In general, thinking about "last" is usually a hack. You probably want
to think about proper dependencies, and declare those.


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list