I know that, with systemd, any scripts put in /lib/systemd/system-shutdown/
will launch at the very end of a shutdown sequence.
Is there a similar type of thing for scripts that I wish to launch immediately? Without a service file?
I know that, with systemd, any scripts put in /lib/systemd/system-shutdown/
will launch at the very end of a shutdown sequence.
Is there a similar type of thing for scripts that I wish to launch immediately? Without a service file?
As you mentioned in a comment, systemd shuts down services in the reverse order that they are started.
You can create a new target that forces your command to be started last and shutdown first. Then set your system to boot to this new "target" state instead of the "multi-user.target" or "graphical.target".
In your new service, set
ExecStop=
to be the thing you want to run first on shutdown.