<p dir="ltr">You should probably just use an ExecStart= (not with the stop you are currently using), have it WantedBy=shutdown.target, and Before= any service which you depend on to still be available</p>
<br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 7, 2024, 00:30 David Elie-Dit-Cosaque <<a href="mailto:deliedit@redhat.com">deliedit@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div>I am trying to create a systemd service that would execute a script at shutdown before any other services start receiving shutdown notifications. I came up with this:</div><div><br></div><div>[Service]<br>Type=oneshot<br>RemainAfterExit=true<br>ExecStart=/usr/bin/true<br>ExecStop=/usr/local/bin/myscript.sh<br>[Install]<br>WantedBy=multi-user.target</div><div><br></div><div>The script does run after shutdown is initiated but since it relies on other services which are also shutting down, it fails. Is there a way to order the shutdown so that myscript.sh is completed first before continuing with the shutdown? </div><div><br></div><div>Thanks!</div><div>David.</div></div>
</blockquote></div>