LinuxQuestions.org
Review your favorite Linux distribution.
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, 04: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, 04:47 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You can try to put your commands in $HOME/.bash_logout.
 
Old 12-22-2008, 07:53 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:21 PM
logout/exit script ?? aherrys Linux - Software 3 12-30-2006 12:42 PM
.logout script On NetBSD EECore *BSD 0 07-10-2005 01:27 PM
logout after script runs bigdog0007 Linux - Newbie 6 06-24-2005 06:42 PM
logout script jaraju Linux - General 1 02-25-2005 11:44 AM


All times are GMT -5. The time now is 01:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration