View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 6 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Thu Mar 02, 2006 3:28 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
***Apologies for those who know about screen and shutdown, this guide is targeted at LINUX newbies.

Sometimes I want the ability to have myth shutdown after a specified period of time. This can be accomplished via the shudown program; for example, the following will shot the machine down after 60 minutes:
Code:
# shutdown -h 60


What I like even better is the ability to run shutdown via an ssh window AND then log out and still have the program running in the background. To do this, you'll need a a program called screen that allows you do "detach" yourself from an ssh session while still keeping it active. Another great uses for screen is when you're doing something time consuming (like an FTP xfer for example) and again you don't want to have the ssh session active to the LINUX box the entire time.

I'm pretty sure screen isn't included with R5A30.2 so do this to get it:

Code:
# apt-get update
# apt-get install screen


Once that finishes simply use screen to multiplex a virtual terminal and run your command. In the following example I'll have the machine shutdown in 3 hours (180 minutes).

Code:
$ screen
(new virtual terminal starts)
$ su
# shutdown -h 180
(at this point shutdown is running, to detach yourself from the virtual session you simply type ctrl+ad)


If for some reason you want to reattach yourself to that session simply type:
Code:
$ screen -r


If you have several screens running and you try that, you'll see something like this:

Code:
$ screen -r
There are several suitable screens on:
        5124.ttyp0.mythtv       (Detached)
        5129.ttyp0.mythtv       (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.


As the instructions tell you, simply use the PID (5124 and 5129 in this case) like this:

Code:
$ screen -r 5124

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 8:13 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
what is wrong with

Code:
nohup shutdown -h 60 &

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 3:30 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
I didn't know about that one... I'll give it a shot, thanks for the post.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 9:04 pm 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
nohup = no hangup = ignore the hangup signal the process gets when the shell exits

& = run in background i.e. after command starts, shell prompt is returned

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 04, 2006 6:37 am 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
khrusher wrote:
nohup = no hangup = ignore the hangup signal the process gets when the shell exits

& = run in background i.e. after command starts, shell prompt is returned


What's the syntax to abort something you ran with nohup similar to the "screen -r" in my example?

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 10, 2006 10:18 am 
Offline
Joined: Sun Feb 05, 2006 10:57 am
Posts: 2
You can abort the shutdown by logging back into the box and running "killall shutdown" as root.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu