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 04-07-2013, 06:29 AM   #1
jamesblue
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Rep: Reputation: Disabled
Shutdown script to gently close programs opened by a user at his start-up session


Hello,

I start several programs automatically when X starts (web browser, email client, torrent program, file manager, etc). I do this through the fluxbox startup file.

I was wondering if its possible, that when I want to quickly shutdown the computer, can I have another script to close each of the programs that was opened automatically on start of the session?

Any idea's on how I might do this?

Last edited by jamesblue; 04-07-2013 at 06:32 AM.
 
Old 04-07-2013, 10:40 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,399

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
That's exactly what a normal shutdown procedure does by first sending a "terminate" signal (15) to each process, allowing it to perform whatever cleanup actions are in its code prior to exiting. Only those processes that do not exit in a reasonable time after receiving the "terminate" signal will then have the rug ripped out from under them by a "kill" signal (9).
 
1 members found this post helpful.
Old 04-07-2013, 11:54 AM   #3
jamesblue
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
will then have the rug ripped out from under them



So if I do '/sbin/halt', and I get bumped to the console (from X), would there be any data loss by the torrent program for example?
 
Old 04-07-2013, 01:11 PM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
torrents are designed to work a lot like rsync in that they make hashes all throughout the file. the next time you connect your torrent client it will check the data on your system, compare it with the data pointed to in the URL, and resume were it needs to continue grabbing data.
 
1 members found this post helpful.
Old 04-07-2013, 05:11 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,399

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Quote:
Originally Posted by jamesblue View Post
So if I do '/sbin/halt', and I get bumped to the console (from X), would there be any data loss by the torrent program for example?
You would need to examine the manpage for halt to be sure, but on my systems that page states,
"When called without the -f option, they [reboot, halt, and poweroff] simply invoke shutdown(8) with the appropriate arguments."
Any of those will go through the normal halt procedure and gracefully shut down programs, unmount filesystems, etc.
 
1 members found this post helpful.
Old 04-08-2013, 02:43 AM   #6
jamesblue
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thankyou both
 
  


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
User session opened and closed msg in /var/log/messages andiramesh Linux - Newbie 9 09-05-2008 05:47 AM
session opened for user news??? dasy2k1 Linux - Security 5 04-24-2008 10:05 AM
(pam_unix) session opened for user root by (uid=0) frenchn00b Debian 1 01-01-2008 07:18 AM
Session close when screensaver start on FC6 japega Linux - Laptop and Netbook 1 06-13-2007 08:45 PM
session opened for user nobody r.stiltskin Debian 4 03-13-2006 01:17 PM


All times are GMT -5. The time now is 11:13 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