cacv12000
asked on
Run shell command at user logout
Hello,
I'd like to run the following command every time a user logs out of his Gnome desktop.
rm -Rf /tmp/*
Is there a way to execute this command automatically as soon as they log off? There is only one user on this system at a time.
OS - Ubuntu Linux 7.10
I'd like to run the following command every time a user logs out of his Gnome desktop.
rm -Rf /tmp/*
Is there a way to execute this command automatically as soon as they log off? There is only one user on this system at a time.
OS - Ubuntu Linux 7.10
adding to what omarfarid said ~/.bash_logout refers to /home/youruser/.bash_logou t and .bash_logout is a hidden file ...hence the dot in front of the filename. So if you dont change your browser settings you wont see it.
Thanks shakoush2001 :)
By the way, in which country do you live?
By the way, in which country do you live?
ASKER
Hi,
But is .bash_logout supposed to run when logging out of Gnome or just when logging out of a bash shell.
I just tried the above recommendations and it worked great when I logged in through ssh and then logged out but when I log into the Gnome desktop and then log out this does not work.
I tested this by creating a file in /tmp as a normal user called test.file.
The reason I'm going through all this trouble is that we use nomachine nx to log in remotely to the Gnome desktop. Gnome applets seem to crash intermittently when going through nx but clearing /tmp between connections seems to resolve that issue. I'd like the /tmp clearing to be automated...
Thanks!
But is .bash_logout supposed to run when logging out of Gnome or just when logging out of a bash shell.
I just tried the above recommendations and it worked great when I logged in through ssh and then logged out but when I log into the Gnome desktop and then log out this does not work.
I tested this by creating a file in /tmp as a normal user called test.file.
The reason I'm going through all this trouble is that we use nomachine nx to log in remotely to the Gnome desktop. Gnome applets seem to crash intermittently when going through nx but clearing /tmp between connections seems to resolve that issue. I'd like the /tmp clearing to be automated...
Thanks!
you can add the code to
/etc/gdm/PostSession/Defau lt
Omar..I am in Lebanon :)..and dont ask about the name it started out as a joke and i got stuck with it since I cant change the display name in EE ;). I have checked your profile and you have got 17 years of experience to show ...I really respect that.
/etc/gdm/PostSession/Defau
Omar..I am in Lebanon :)..and dont ask about the name it started out as a joke and i got stuck with it since I cant change the display name in EE ;). I have checked your profile and you have got 17 years of experience to show ...I really respect that.
Thank you shakoush2001 :)
Where I can get more info bout /etc/gdm/PostSession/Defau lt ?
Where I can get more info bout /etc/gdm/PostSession/Defau
Your welcome Omar as for the script..check out this article..simple but it does the job..I personally prefer KDE
http://www.bxlug.be/en/articles/74
http://www.bxlug.be/en/articles/74
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
On the last script I obviously meant
"In /usr/local/bin/nx-gnome-se ssion" not "In /usr/NX/etc/node.cfg"
My apologies.
"In /usr/local/bin/nx-gnome-se
My apologies.
ASKER
Excellent Filipe!
The other solutions above do work but not for my particular case. Thanks!
The other solutions above do work but not for my particular case. Thanks!
For users using bash, add the command to ~/.bash_logout which should be executed when logged out.