[systemd-devel] systemd oneshot service stop on shutdown problem

Lennart Poettering lennart at poettering.net
Mon Sep 10 18:02:23 UTC 2018


On Mo, 20.08.18 18:00, Radoslaw Garbacz (radoslaw.garbacz at xtremedatainc.com) wrote:

> Hi,
> 
> Could you please advise me with regard to systemd configuration for service
> type=oneshot.
> It does not execute stop on shutdown/reboot, but works as intended when
> called manually.
> 
> Online discussions indicate that the configuration below should be working.
> 
> 1) service configuration:
> [Unit]
> Description= ### service test ###
> 
> [Service]
> ExecStart=/tmp/aaa.sh start
> ExecStop=/tmp/aaa.sh stop
> Type=oneshot
> RemainAfterExit=yes
> TimeoutStopSec=100
> 
> [Install]
> WantedBy=multi-user.target default.target
> 
> 
> 2) Tried also:
> WantedBy=shutdown.target ...

Did you enable the service? You need to call "systemctl enable …" on
the unit so that the WantedBy= is actually honoured and the unit
linked into the initial and final transaction.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list