Jump to Navigation

091 - reboot, poweroff, halt, shutdown

1. halt, powroff, reboot

Halt notes that the system is being brought down in the file /var/log/wtmp, and then either tells the kernel to halt, reboot or poweroff the system.If halt or reboot is called when the system is not in runlevel 0 or 6, in other words when it's running normally, shutdown will be invoked instead (with the -h or -r flag). The rest of this manpage describes the behaviour in runlevels 0 and 6, that is when the systems shutdown scripts are being run.

halt must be called by "poweroff" & "reboot" in order to stop system. Then shutdown is called to terminate system.

* poweroff ---> halt ---> shutdown
* reboot ---> halt ---> shutdown

Synopsis:

/sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] [-h]
/sbin/reboot [-n] [-w] [-d] [-f] [-i]
/sbin/poweroff [-n] [-w] [-d] [-f] [-i] [-h] 

Oprion:

-n Don't sync before reboot or halt.
-w Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).
-e  Don't write the wtmp record. The -n flag implies -d.
-f  Force halt or reboot, don't call shutdown.
-i  Shut down all network interfaces just before halt or reboot.
-h  Put all harddrives on the system in standby mode just before halt or poweroff.
-p  When halting the system, do a poweroff. This is the default when halt is called as poweroff.

Example:

# poweroff  [halt -p][ shutdown -h now][init 0]
# reboot [shutdown -r now]

2. shutdown

shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down, and login is blocked.
It is possible to shut the system down immediately or after a specified delay. All processes are first notified that the system is going down
by the signal SIGTERM. This gives programs like vi the time to save the file being edited, mail and news processing programs a chance to
exit cleanly, etc. shutdown does its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used to halt the system,
runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a state where administrative tasks can be performed;
this is the default if neither the -h or -r flag is given to shutdown. To see which actions are taken on halt or reboot see the appropriate
entries for these runlevels in the file /etc/inittab.

synopsis:

/sbin/shutdown [-t sec] [-arkhncfF] time [warning-message]

Option:

-a Use /etc/shutdown.allow.
-t sec Tell "init" to wait sec seconds between sending processes the warning and the kill signal, before changing to another runlevel.
-k Don't really shutdown; only send the warning messages to everybody.
-r Reboot after shutdown.
-h Halt after shutdown.
-n [DEPRECATED] Don't call init(8) to do the shutdown but do it ourself. The use of this option is discouraged, and its results are not always what you'd expect.
-f Skip fsck on reboot.
-F Force fsck on reboot.
-c Cancel an already running shutdown. With this option it is of course not possible to give the time argument, but you can enter a explanatory message on the command line that will be sent to all users.
time When to shutdown
warning-message Message to send to all users.

Example:

# shutdown -t 30
# shutdown -r +20 [shutdown in 20 minutes & reboot]
# shutdown -h 20:00 [shutdown at 8:00pm]
# shutdown -h +10  [shutdown in 10 minutes]

 

Linux:


Main menu 2

Story | by Dr. Radut