This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Logout script not getting executed

Tags: None
(comma "," separated)
User avatar
Spectrum
Registered Member
Posts
17
Karma
0
OS

Logout script not getting executed

Sun Sep 27, 2020 3:27 pm
Hi! I am running Kubuntu 20.04. I am trying to run a script on every KDE logout.

My script contains this:

Code: Select all
date > date.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: Select all
spectrum@spectrum-kubuntu-2004-2:~$ ll shutdown2.sh
-rwxrwxr-x 1 spectrum spectrum 17 Sep 27 17:15 shutdown2.sh*


I can run the script manually from the command line and it generates the file ~/date.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 ~/date.txt does not get generated.

By searching I found two other recent threads (1, 2) with the same problem - logout script not running - but no solution. Is this a known bug in KDE?

Thanks in advance!
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
Hi!

You should provide the full path to the file. Try this one
Code: Select all
#!/bin/bash
/bin/date > /home/$USER/date.txt
/usr/bin/logger "Successfully started $0!"
User avatar
Spectrum
Registered Member
Posts
17
Karma
0
OS
koffeinfriedhof wrote:Hi!

You should provide the full path to the file. Try this one
Code: Select all
#!/bin/bash
/bin/date > /home/$USER/date.txt
/usr/bin/logger "Successfully started $0!"

Woo! You're right. Thanks a lot, man.

I did try adding full path to the executable, but I didn't realize I also needed full path on the text file, so it looked as though it wasn't working. But now it looks like it works. Thanks! :)


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft