LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shutdown in 30 seconds? (http://www.linuxquestions.org/questions/linux-newbie-8/shutdown-in-30-seconds-806526/)

clifford227 05-07-2010 12:39 PM

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?

paulsm4 05-07-2010 12:44 PM

Hi -

Try this:
Quote:

/sbin/shutdown -h -t 30
'Hope that helps .. PSM

druuna 05-07-2010 12:47 PM

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.

ajeetsinghraina 05-07-2010 12:48 PM

Amazed to see few tool for that too.
Enjoy.

http://software.informer.com/getfree...n-few-seconds/

pwc101 05-07-2010 12:48 PM

Quote:

Originally Posted by clifford227 (Post 3960586)
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...

druuna 05-07-2010 12:51 PM

@pwc101: Maybe not too elegant, but it is the only way to set a time shorter then 1 minute (not counting now);)

clifford227 05-07-2010 03:22 PM

Thanks :)

SaintDanBert 05-07-2010 04:29 PM

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


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