[systemd-devel] Script in /usr/lib/systemd/system-shutdown not executed on init 6

Andrei Borzenkov arvidjaar at gmail.com
Wed Nov 23 13:21:01 UTC 2016


On Wed, Nov 23, 2016 at 3:42 PM, Benoit SCHMID <Benoit.Schmid at unige.ch> wrote:
> Hello,
>
> On 11/23/2016 11:55 AM, Lennart Poettering wrote:
>> The scripts dropped there are executed very late during the shutdown
>> process at a time where all processes have already been killed and all
>> mount points have been unmounted or at least remounted
>> read-only.
>
> Is there an easy way to create a systemd service that would be stopped
> very early
> at the shutdown and would avoid the other services stop command to be
> executed.
>
> In other world, on my XXX server, the most important service is XXX.
> Stopping XXX takes time (~1 min per XXX system).
>
> Therefore, in case of init 6, I would like to stopxxx
> When stopxxx finishes or timeouts then systemd
> could start stopping the other services.
>


The following may work (untested):

[Unit]
Description=stop very important services and start shutdown
After=list of very important services
Conflicts=list of very important services

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl --no-block shutdown

Now starting your service /should/ result in stopping of listed
services and then triggering actual system shutdown.


> Is there an easier way than trying After= and Before= options?
>
> Thanks for the time you have taken to answer my questions.
>
> --
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>
>      Benoit Schmid              Tel: (+41-22) 379-7209
>
>      University of Geneva - Information Technology Division
>
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list