<div dir="ltr"><div>Hi,</div><div><br></div><div>Could you please advise me with regard to systemd configuration for service type=oneshot.</div><div>It does not execute stop on shutdown/reboot, but works as intended when called manually.</div><div><br></div><div>Online discussions indicate that the configuration below should be working.<br></div><div><br></div><div>1) service configuration:</div><div>[Unit]<br>Description= ### service test ###<br><br>[Service]<br>ExecStart=/tmp/aaa.sh start<br>ExecStop=/tmp/aaa.sh stop<br>Type=oneshot<br>RemainAfterExit=yes<br>TimeoutStopSec=100<br><br>[Install]<br>WantedBy=multi-user.target default.target<br></div><div><br></div><div><br></div><div>2) Tried also:</div><div>WantedBy=shutdown.target ...</div><div><br></div><div><br></div><div><br></div><div>3) # systemctl status xdctest<br>● xdctest.service - ### service test ###<br> Loaded: loaded (/etc/systemd/system/xdctest.service; enabled; vendor preset: disabled)<br> Active: active (exited) since Mon 2018-08-20 22:43:21 UTC; 1min 13s ago<br> Process: 22304 ExecStop=/tmp/aaa.sh stop (code=exited, status=0/SUCCESS)<br> Process: 22407 ExecStart=/tmp/aaa.sh start (code=exited, status=0/SUCCESS)<br> Main PID: 22407 (code=exited, status=0/SUCCESS)<br><br>Aug 20 22:43:01 ip-10-43-215-250.ec2.internal systemd[1]: Starting ### service test ###...<br>Aug 20 22:43:01 ip-10-43-215-250.ec2.internal aaa.sh[22407]: BEGIN: TESTING systemd: start<br>Aug 20 22:43:21 ip-10-43-215-250.ec2.internal aaa.sh[22407]: END: TESTING systemd: start<br>Aug 20 22:43:21 ip-10-43-215-250.ec2.internal systemd[1]: Started ### service test ###.<br></div><div><br></div><div><br></div><div><br></div><div>4) # systemctl --version<br>systemd 219<br>+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN<br><br></div><div><br></div><div><br></div><div>5) OS: GNU Linux, CentOS 7</div><div><br></div><div><br></div><div>Thanks in advance,</div><div><br></div><div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Radoslaw Garbacz<br></div><br></div></div></div></div>
</div></div>