On So, 02.09.18 15:37, Ralf Sieger (ralf.sie...@gmx.net) wrote: > Hi, > > I want my system to pause on shutdown to wait till my backup has finished > if it is running. > For this I've created this small service: > > [Unit] > Description=borg shutdown wait > [Service] > Type=oneshot > ExecStart=/bin/true > RemainAfterExit=true > ExecStop=/usr/local/bin/wait_borg > TimeoutStopSec=600 > [Install] > WantedBy=multi-user.target > > I'm using ubuntu 18.04, systemd 237 > > Manually stopping the service via > systemctl stop borg_wrapper > does wait and thus works. > > But its not working on normal shutdown/poweroff ... > From the logs I can't even see an entry with > "Stopping borg shutdown wait" in syslog. > > Does anyone has an idea?
Note that you need to start (i.e. enable) the service first for this to work. In systemd only stuff that is started gets stopped... I presume "wait_borg" talks to some other service "borg" waiting for it to complet what it is doing? Note that with the above you are not ordering the main "borg" service against your wait service, which means the "borg" service might get stopped in parallel with your wait service. You probably want a "After=borg.service" or so in the [Service] section of your wait service (this is because the shutdown order of services is always the reverse of the start-up order of services in systemd, and with After=borg.service you hence say that your service shall be terminated first, and borg.service shall be terminated only after it finished. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel