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

Lennart Poettering lennart at poettering.net
Thu Sep 24 05:50:50 PDT 2015


On Thu, 24.09.15 09:41, 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...

Well, if that's what happens, then it's certainly not systemd which
unmounts /run. It considers it API, and will never unmount it ever.

Unmounting /run is very much pointless, if you are seeing that
something does that, then fix that something to not do it.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list