Announcement

Collapse
No announcement yet.

A stop job is running for session N of user - logout script does not get run

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] A stop job is running for session N of user - logout script does not get run

    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 disconnect from ProtonVPN before shutting down, the problem is gone:

    Code:
    $ 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):

    Code:
    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:

    Code:
    -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.

    My problem looks closely connected to this other problem I had. I was able to fix that by fixing the script itself. But my script here looks completely trivial and works fine when run on its own.

    Am I doing something wrong? Why is my script not running?

    Thanks in advance!

    #2
    It turns out I need to use full paths in my script:

    Code:
    #!/bin/bash
    sudo /usr/local/bin/protonvpn d
    ... or, if I want the text file output:

    Code:
    #!/bin/bash
    sudo /usr/local/bin/protonvpn d > /home/$USER/protonvpn.txt
    Now it seems to work.

    Credit to koffeinfriedhof at forum.kde.org for this solution.

    Comment

    Working...
    X