System shutdown

shutdown command, which brings the system down in a secure way, should always be used for halting or rebooting the system. 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.
The shutdown command does its job by signalling the init process, asking it to change the runlevel. The syntax for shutdown is shown below:
shutdown option(s) time warning_message
Common shutdown options are:
- 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.
- F Force fsck on reboot
- f Skip fsck on reboot.
- h Halt after shutdown.
- k Don't really shutdown; only send the warning messages to
everybody.
- r Reboot after shutdown
- t SEC Tell init to wait SECconds between sending processes the
warning and the kill signal, and changing to another runlevel.

The shutdown command also requires a time argument. Common time
arguments are:
- hh:ss Shutdown at the time specified
- +M Shutdown after M minutes have elapsed
- now Shutdown immediately (an alias for +0)
The warning message is sent to all logged on users periodically until shutdown takes place. If no message is specified a default message is sent.
Only root can use the shutdown command unless the file /etc/shutdown.allowexists, in which case users listed in this file can also shutdown the system. Assuming the key combination CTRL-ALT-DEL is trapped by an appropriate entry in /etc/inittab then the shutdown command will be called when these keys are pressed. This means that everyone who has physical access to the console keyboard could shut the system down. To prevent this, if shutdown is called from init, it checks to see if the file /etc/shutdown.allow is present. It then compares the login names in that file with the list of people that are logged in(from /var/run/utmp). Only if one of those authorised users or root is logged in, will it proceed. Otherwise it will write the following message to the system console:
shutdown: no authorised users logged in
An example of using the shutdown command is illustrated below:
[root@redhat /root]# shutdown -k +1