LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-22-2008, 03:32 AM   #1
minge.zu
LQ Newbie
 
Registered: Oct 2008
Location: Beijing
Posts: 17

Rep: Reputation: 0
Question where to write my logout script?


Hi,everyone,I have a problem about system log out.
My program is running when the system log out.The system will kill the process of my program.What I want to do is to do some clean operations before the process is killed.How can I achieve this?Is there scripts where I can write my clean operations?
Any advise is appreciated.
 
Old 12-22-2008, 03:47 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You can try to put your commands in $HOME/.bash_logout.
 
Old 12-22-2008, 06:53 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Do you mean it dies

1. when you logout
OR
2. when the system shuts down

For 1.
disconnect the prog from the terminal session

nohup your_prog &

2.
Add an interrupt handler to your program
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
would script run after logout? mokku Linux - Newbie 3 12-03-2007 11:21 AM
logout/exit script ?? aherrys Linux - Software 3 12-30-2006 11:42 AM
.logout script On NetBSD EECore *BSD 0 07-10-2005 12:27 PM
logout after script runs bigdog0007 Linux - Newbie 6 06-24-2005 05:42 PM
logout script jaraju Linux - General 1 02-25-2005 10:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration