[systemd-devel] [script] Eject CD before shutdown

Lennart Poettering lennart at poettering.net
Thu Sep 13 09:19:31 PDT 2012


On Thu, 13.09.12 18:04, Philip Müller (philm at manjaro.org) wrote:

[...]

> All operations are timed out in systemd by default. You can turn this
> off by pasing TimeoutSec=0.
> 
> However, I'd probably recommend you to define your service a bit
> differently. Add this to [Unit]:
> 
>         DefaultDependencies=no
>         After=shutdown.target
>         Before=final.target
> 
> And just use ExecStart= to spawn your code, drop the ExecStop=.
> 
> And then pull that in from final.target.
> 
> In case you wonder: the charts at the end of this man page might
> explain better where a service like that is positioned:
> 
> http://www.freedesktop.org/software/systemd/man/bootup.html

[...]

> [Unit]
> Description=LiveMedia Eject Service
> Before=unmount.target
> After=shutdown.target
> DefaultDependencies=no
> 
> [Service]
> Type=oneshot
> ExecStart=/etc/manjaro/ejectcd
> StandardInput=tty-force
> RemainAfterExit=yes
> 
> [Install]
> WantedBy=shutdown.target

Use "Before=final.target" as I suggested, not "Before=unmount.target"
(there is no unmount.target anyway, only umount.target).

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list