I have this problem: I've set up a script to run on logout, and the script doesn't run.
The script is supposed to solve this problem: On shutdown, I get the message: "A stop job is running for session (number) of user (name)". This takes 90 seconds to time out, and I have no option of killing it. I don't want shutdown to take an extra 90 seconds.
This appears to be caused by ProtonVPN. If I follow this debugging guide, I can see a log message suggesting that the offending process is openvpn:
Sep 26 18:25:44 ... systemd: session-1.scope: Stopping timed out. Killing. Sep 26 18:25:44 ... systemd: session-1.scope: Killing process 16246 (openvpn) with signal SIGKILL.
If I disconnect from ProtonVPN before shutting down, the problem is gone:
$ sudo protonvpn d
NB: I have added this application to my sudoers so I can sudo it without having to enter my password. This works fine for my startup script, at least.
What I want to do: Set up a script that disconnects from VPN (by running sudo protonvpn d) automatically upon logout.
So I've written a script containing this (and nothing else):
sudo protonvpn d > ~/protonvpn.txt
I pipe the output into a file purely in order to verify that the script gets run. I've set execution permissions on the script file so it can run:
-rwxrwxr-x 1 spectrum spectrum 35 Sep 24 18:48 shutdown.sh*
I can run the script manually from the command line and it generates the file ~/protonvpn.txt.
I've set up the script in System Settings -> Starup and Shutdown -> Autostart to run on logout. A symlink to the script appears in
~/.config/plasma-workspace/shutdown/. But when I log out, the file
~/protonvpn.txt does not get generated. And if I shut down while having VPN connected, I still get the 90 second timeout.
Am I doing something wrong? Why is my script not running?
Alternatively, can you give me any other advice on how to disconnect from VPN or otherwise fix the slow shutdown?
Thanks in advance!