sh script keeps running after I log out of Cinnamon

Please post suggestions for improvement of Cinnamon here
https://github.com/linuxmint/Cinnamon
Post Reply
chrisonmint
Level 3
Level 3
Posts: 143
Joined: Sun May 03, 2015 10:49 am

sh script keeps running after I log out of Cinnamon

Post by chrisonmint » Mon Jan 11, 2016 4:04 am

My problem is that I have a shell script which I use to keep docky running - its a great dock, but seems to quit/crash every few days. My laptop has multiple users and we spend lots of time switching between users, sleeping/waking the laptop etc. Docky doesnt appear to like it and I wanted a way to re-launch it automatically.

My script re-launches docky after it quits. I have it run as a command in the "startup applications", but it is still going after I log out! We end up with multiple instances of the script running for me and the other users and burning through CPU cycles (up to 65%!)

Why isnt the script being stopped when I log out?

many thanks
Chris

Code: Select all

#!/bin/bash

if [[ -z "$1" ]];then
    echo "ERROR: must specify program"
    exit 1
fi

while (( 0 == 0 ));do
    $@ &
    pid=`jobs -l | awk '{print $2}'`
    wait $pid
done 

kilowatt2
Level 1
Level 1
Posts: 16
Joined: Wed Mar 19, 2014 8:39 am

Re: sh script keeps running after I log out of Cinnamon

Post by kilowatt2 » Mon Jan 11, 2016 5:28 am

http://www.cyberciti.biz/faq/linux-unix ... u-log-out/
Logout file name

Commands in .logout are run when you log out.

bash shell: ~/.bash_logout

chrisonmint
Level 3
Level 3
Posts: 143
Joined: Sun May 03, 2015 10:49 am

Re: sh script keeps running after I log out of Cinnamon

Post by chrisonmint » Mon Jan 11, 2016 5:34 am

kilowatt2 wrote:http://www.cyberciti.biz/faq/linux-unix ... u-log-out/
Logout file name

Commands in .logout are run when you log out.

bash shell: ~/.bash_logout
Hi Kilowatt2, thanks that a nice workaround.

I'm going to try "killall keep_running.sh" in .bash_logout and see if that sorts it....

chrisonmint
Level 3
Level 3
Posts: 143
Joined: Sun May 03, 2015 10:49 am

Re: sh script keeps running after I log out of Cinnamon

Post by chrisonmint » Mon Jan 11, 2016 5:45 am

chrisonmint wrote:
Hi Kilowatt2, thanks that a nice workaround.

I'm going to try "killall keep_running.sh" in .bash_logout and see if that sorts it....
no, that didnt work. the script is still going after I log out.

is this normal behaviour for a shell script??

chrisonmint
Level 3
Level 3
Posts: 143
Joined: Sun May 03, 2015 10:49 am

Re: sh script keeps running after I log out of Cinnamon

Post by chrisonmint » Fri Jan 15, 2016 4:00 pm

kilowatt2 wrote:http://www.cyberciti.biz/faq/linux-unix ... u-log-out/
Logout file name

Commands in .logout are run when you log out.

bash shell: ~/.bash_logout
For graphical environments, the bash logout script is NOT run - that is just for command line sessions.

The place to look is /etc/mdm/PostSession/Default

I have added "killall keep_running.sh" and that seems to be working to kill off this stubborn script.

Post Reply

Return to “Cinnamon”