I'm running Ubuntu 18.04.1 and I'm trying to create a script that shuts down Chromium properly before shutting down the system so that it doesn't give me "restore session" popup after booting. I figured I'll use killall to this and came up with
#!/bin/bash killall -HUP "chromium-browser --enable-pinch"
that seems to do the trick.
However, now I have a problem with actually running this script at shutdown or reboot.
First thing I tried was putting it in
chmod +x and then symlinking it to
K99shutdownscript and later
K01ashutdownscript. However, that didn't work for me.
I thought maybe I should just create a new systemd service, so I created
/etc/systemd/system with contents like this:
[Unit] Description=Saves Chromium session [Service] Type=oneshot RemainAfterExit=true ExecStart=/bin/true ExecStop=/home/istir/shutdownscript.sh [Install] WantedBy=multi-user.target
Then I ran
systemctl start shutdownscript.service and
systemctl enable shutdownscript.service but it still didn't work as intended.
The solution is probably very simple but I returned to Linux after around 6 years of using Windows and macOS so I don't really remember what did I do earlier to make shutdown scripts.
Thanks for any help!