LinuxQuestions.org
Visit Jeremy's Blog.
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 05-07-2010, 01:39 PM   #1
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Rep: Reputation: 64
shutdown in 30 seconds?


Hi,

I want to issue the 'shutdown' command and have it shutdown the computer in 30 seconds, however, when I do this:

Code:
/sbin/shutdown -h -t sec 30
the broadcast message tells me that the shutdown will happen in 30 minutes!

is there a way to shutdown in 30 seconds?
 
Old 05-07-2010, 01:44 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Try this:
Quote:
/sbin/shutdown -h -t 30
'Hope that helps .. PSM
 
Old 05-07-2010, 01:47 PM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

-t sec 30 is not the option that tells shutdown to wait. It (-t 30, not -t sec 30) tells init when to start sending SIGTERM and SIGKILL signals.

time tells shutdown how long to wait. It is done in hours and minutes (or just minutes).

/sbin/shutdown -h 1 Wait one minute and start the shutdown process.

Hope this helps.
 
Old 05-07-2010, 01:48 PM   #4
ajeetsinghraina
Member
 
Registered: May 2010
Location: India
Distribution: Ubuntu 7.04/8.04/8.10/10.04, RHEL 6, OpenSUSE,Mandriva,Fedora, CentOS, XandrOS, Slackware, OpenSolar
Posts: 155

Rep: Reputation: 55
Amazed to see few tool for that too.
Enjoy.

http://software.informer.com/getfree...n-few-seconds/
 
0 members found this post helpful.
Old 05-07-2010, 01:48 PM   #5
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by clifford227 View Post
Hi,

I want to issue the 'shutdown' command and have it shutdown the computer in 30 seconds, however, when I do this:

Code:
/sbin/shutdown -h -t sec 30
the broadcast message tells me that the shutdown will happen in 30 minutes!

is there a way to shutdown in 30 seconds?
Code:
sleep 30s; shutdown -h now
would do it. Perhaps not the most elegant solution...
 
1 members found this post helpful.
Old 05-07-2010, 01:51 PM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
@pwc101: Maybe not too elegant, but it is the only way to set a time shorter then 1 minute (not counting now)
 
Old 05-07-2010, 04:22 PM   #7
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
Thanks
 
Old 05-07-2010, 05:29 PM   #8
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-15 with Cinnamon & KDE
Posts: 1,368
Blog Entries: 3

Rep: Reputation: 86
The Linux Man Pages Online http://www.linuxmanpages.com/man8/shutdown.8.php offer that there are two times associated with the shutdown command:

shutdown -t sec options delay message
The first time, -t sec tells the init process how many seconds to wait before sending processes SIGTERM or SIGKILL -- time for those processes to end themselves before init does it by force -- and changing runlevel.

The second time, delay names an interval between typing the command and actual activation of the shutdown processing. The documentation says,

"The time argument can have different formats. First, it can be an absolute time in the format hh:mm, in which hh is the hour (1 or 2 digits) and mm is the minute of the hour (in two digits). Second, it can be in the format +m, in which m is the number of minutes to wait. The word now is an alias for +0.

If shutdown is called with a delay, it creates the advisory file /etc/nologin which causes programs such as login(1) to not allow new user logins. Shutdown removes this file if it is stopped before it can signal init (i.e. it is cancelled or something goes wrong). It also removes it before calling init to change the runlevel."
There used to be a resource file or similar that shutdown would read for system-wide default delays and such. That no longer seems to be available as of Ubuntu Jaunty and similar distributions.

Cheers,
~~~ 0;-Dan
 
  


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
convert total no of seconds in the format hour minutes and seconds suchi_s Programming 15 03-15-2011 12:34 PM
[SOLVED] Experiencing freezing up to 5 seconds every 10 seconds, could these be the problem? Switch7 Slackware 10 11-16-2009 05:36 PM
hdparm power save, 15 seconds of spin, 5 seconds of rest... Romanus81 Linux - Laptop and Netbook 1 01-01-2009 06:24 PM
"Display Server has been shutdown 6 times in 90 seconds..." devghai Ubuntu 5 07-04-2007 10:31 PM
what type does shutdown use to store seconds? dvm Linux - Software 3 12-15-2004 10:44 AM


All times are GMT -5. The time now is 04:23 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration