Q:

Stop systemd service after another at shutdown and reboot

I want to run a script at shutdown and reboot after rsyslog has stopped.
What do I have to write in my systemd service file /lib/systemd/system/test.service. So far I have
[Unit]
Description=test
RequiresMountsFor=/

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/which/path/should/itbe

[Install]
WantedBy=reboot.target halt.target shutdown.target poweroff.target

How can I run this after rsyslog has stopped?
This seems to be the only way How to run a script at shutdown on Debian 9 or Raspbian 8 (Jessie).

A:

You should add an Before=rsyslog.service in the [Unit] section
By the way, you should probably change the last line with WantedBy=multi-user.target

