home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] a couple (simple?) systemd questions

On Fri, Aug 05, 2016 at 12:52:20PM -0400, Robert P. J. Day wrote:
>   i really should know this stuff, but ...
>
> 1) is there a way to make sure a service is the *last* service invoked
> when going to multi-user mode?

Why? Do you really need that *directly*—suspect not, or are you just
dependent on some other items, or just want the job to be of lesser CPU,
I/O, etc. priority?

> currently, i have:
>
>   [Install]
>   WantedBy=multi-user.target
>
> just to make sure it's run, but for safety, i'd prefer it's the last
> service run out of all of those.

I don't think systemd was designed for *that in particular*.

> 2) i also want that service, once it completes, to reboot the machine.

Do you really want that, or do you want a service to be a dependency for
reboot? Why not WantedBy=shutdown.target (or reboot.target)?

> other than simply adding a "reboot" command at the bottom of the
> script, is there a systemd directive that specifies the same thing?

rebot ≡ systemctl reboot

reboot is part of systemd-sysvcompat, which just uses /dev/initctl,
which systemd has a legacy interface for.

Cheers,

Alex Pilon