LinHES Forums http://forum.linhes.org/ |
|
HOWTO: execute a timed shutdown http://forum.linhes.org/viewtopic.php?f=11&t=8780 |
Page 1 of 1 |
Author: | graysky [ Thu Mar 02, 2006 3:28 pm ] |
Post subject: | HOWTO: execute a timed shutdown |
***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
|
Author: | khrusher [ Fri Mar 03, 2006 8:13 am ] |
Post subject: | |
what is wrong with Code: nohup shutdown -h 60 &
|
Author: | graysky [ Fri Mar 03, 2006 3:30 pm ] |
Post subject: | |
I didn't know about that one... I'll give it a shot, thanks for the post. |
Author: | khrusher [ Fri Mar 03, 2006 9:04 pm ] |
Post subject: | |
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 |
Author: | graysky [ Sat Mar 04, 2006 6:37 am ] |
Post subject: | |
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? |
Author: | tdstds [ Fri Mar 10, 2006 10:18 am ] |
Post subject: | |
You can abort the shutdown by logging back into the box and running "killall shutdown" as root. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |