[Unit] Description=test Before=shutdown.target [Service] ExecStart=/bin/true ExecStop=/usr/local/bin/test.sh RemainAfterExit=yes [Install] WantedBy=multi-user.target
I tried a lots of examples, but didn't work. The above example works both restart and shutdown. I want to work ONLY at shutdown.
I don't have server. It is my personal pc. I have Gnu/linux os. Is it possible to run script only at shutdown and not restart?