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

Filipe Brandenburger filbranden at google.com
Mon Aug 20 23:47:10 UTC 2018


On Mon, Aug 20, 2018 at 4:00 PM Radoslaw Garbacz
<radoslaw.garbacz at xtremedatainc.com> wrote:
> 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.

I can't reproduce this, it works fine for me on reboot, according to
the journalctl logs below:

$ journalctl -u xdctest
-- Logs begin at Mon 2018-08-20 23:39:33 UTC, end at Mon 2018-08-20
23:43:52 UTC. --
Aug 20 23:39:45 centos7 systemd[1]: Starting ### service test ###...
Aug 20 23:39:45 centos7 aaa.sh[353]: BEGIN: TESTING systemd: start
Aug 20 23:40:04 centos7 aaa.sh[353]: END:   TESTING systemd: start
Aug 20 23:40:04 centos7 systemd[1]: Started ### service test ###.
Aug 20 23:42:08 centos7 systemd[1]: Stopping ### service test ###...
Aug 20 23:42:08 centos7 aaa.sh[1225]: BEGIN: TESTING systemd: stop
Aug 20 23:42:28 centos7 aaa.sh[1225]: END:   TESTING systemd: stop
Aug 20 23:42:28 centos7 systemd[1]: Stopped ### service test ###.
-- Reboot --
Aug 20 23:42:44 centos7 systemd[1]: Starting ### service test ###...
Aug 20 23:42:44 centos7 aaa.sh[354]: BEGIN: TESTING systemd: start
Aug 20 23:43:03 centos7 aaa.sh[354]: END:   TESTING systemd: start
Aug 20 23:43:03 centos7 systemd[1]: Started ### service test ###.

Only difference from your reported setup is that I have the aaa.sh
script under /usr/local/bin/ and I only used
WantedBy=multi-user.target (and not default.target), but I believe
none of those should make a difference...

Cheers,
Filipe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4851 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180820/a496cab6/attachment.bin>


More information about the systemd-devel mailing list