[systemd-devel] Running a script as FIRST script before shutdown

Andrei Borzenkov arvidjaar at gmail.com
Thu Sep 24 04:51:11 PDT 2015


On Thu, Sep 24, 2015 at 10:41 AM, Luca Bertoncello
<L.Bertoncello at queo-group.com> wrote:
> Hi Andrei,
>
>  > Try RequiresMountsFor=/run/whatever
>
> Not enough...
> Currently I have:
>
> [Unit]
> Description=TEST - oVirt interface for managing host
> After=local-fs.target network.target vdsmd.service vdsm-network.service libvirtd.service libvirt-guests.service
> Wants=local-fs.target network.target vdsmd.service vdsm-network.service libvirtd.service libvirt-guests.service
> RequiresMountsFor=/run
>
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=/usr/local/bin/ovirt-maintenance.sh active
> ExecStop=/usr/local/bin/ovirt-maintenance.sh maintenance
> KillMode=none
> StandardOutput=syslog+console
>
> [Install]
> WantedBy=multi-user.target
>
> But on Shutdown the system first stops other services and umount /run, and then call my script...

/run is API mount and systemd should not be unmounting it at all. Do
you have any chance to run serial or net console so you can capture
output at shutdown?


More information about the systemd-devel mailing list