Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing script on logout 1

Status
Not open for further replies.

TonyGroves

Programmer
Aug 13, 2003
2,389
IE
I want to have certain jobs done every time I log out on my Debian Sarge machine. Specifically, unmounting certain removable storage devices, and possibly other jobs. Does anybody know of a way I can implement this?

Thanks.
 
I believe there are scripts run for RC6 / runlevel 6.

/etc/init.d/RC6.d/.....

That's for shutdown.

Logoff means something else, of course. Help?

D.E.R. Management - IT Project Management Consulting
 
I've put the commands at the end of .xsession, after the window-manager startup command, so that when the WM finishes, the commands get executed. Since I nearly always use X, that should be enough. However, it would be nice to have something that would work in a non-X session as well.
 
create a file called

.bash_logout

in your home directory. Put whatever commands you want executed upon logout in this file. Now, whenever you logout, this script will execute and take care of any cleanup/other stuff that needs to be done.
 
Hmm ... that works with a terminal session, but unfortunately not an X session. And replacing .xsession's logout commands with a call to .bash_logout doesn't work either. However, I now have things working for both X and non-X sessions, so I'm reasonably happy.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top