Shutdown a specific service in systemd shutdown

Hi everyone,

When the system is shutdown, systemd will terminate all services in parallel manner, is there any ways to tell systemd to shutdown a specific service first, then shutdown all remaining services?


Not easily. May be if you explain in more details what you are trying to do, we can suggest alternative ways to achieve it.

And you choose as your openSUSE version: OTHER VERSION, which tells us that you do not use one of the “supported” versions. Then of course we are the more curious what version you are running.

That’s not too difficult to do,
You can copy and create a modified version of any systemd service which will over-ride the original.
Your custom version can specifiy that another Unit file representing a service be started or completed first.

As I’ve commented in a similar post about configuring and modifying the systemd shutdown, there’s no guarantee it would be executed. Historically, all Linux distros have supported a number of ways to shut down a system, and if someone for instance were to invoke the shutdown binary or use a Desktop button, the systemd shutdown may be bypassed.

So, unless a systemd shutdown is executed (and yes, there is more than one depending on what you really want), YMMV.


Please give us example of unit that is guaranteed to be stopped before any other unit.