shutdownThe shutdown command brings down system in a secure way. All the logged-in users are notified about the system shutdown. Signal SIGTERM notifies all the processes that the system is going down, so that processes can be saved and exit properly. Command shutdown signals the init process to change the runlevel. Runlevel 0 halts the system Runlevel 6 reboots the system Runlevel 1 is default state. Five minutes before shutdown sequence starts, file /etc/nologin is created when shutdown is scheduled for future which does not allow new user logins. If by any reason, command shutdown is stopped before signalling init, this file is removed. It is also removed to change runlevel before signalling init. To run shutdown command root user access is required. Shutting down systemYou can shutdown a system by passing a definite time (in minutes). System will automatically shutdown after specified minute giving a message and time to save all work. Syntax: Example: shutdown 3 Look at the above snapshot, message is displayed on the terminal. To immediately shutdown the system, use now option, Syntax: System will shutdown immediately. Rebooting the systemWith option r, system will shutdown immediately and automatically reboot. Syntax: Example: shutdown -r 3 Look at the above snapshot, system will automatically reboot as shown in the message. Power-off or halt-off the systemOption h decide whether the system will power-off or halt-off after shutting down. Syntax: Example: shutdown -h 3 Look at the above snapshot, system decided to halt-off. power-off the systemTo power-off the system option P is used. You don't have to manually power-off your system, this option will automatically power-off your system. Syntax: Example: shutdown -P 3 Printing a message during shutdownAdmin can convey a message to all the logged in users stating reason for sudden shutdown. Syntax: Example: shutdown 3 "message" Look at the above snapshot, admin message is displayed in the last line of output. Halt-off the systemOption H is used to halt-off the system after system is brought down. Syntax: Example: shutdown -H 3 Cancel shutdownIf due to any reason you want to cancel the shutdown command within the specified time, c option can be used. Syntax: Sending warnings and disabling loginsOption k will not halt or power-off the system, but just sends the warning and disable all the logins. System will not actually shutdown. Syntax: Example: shutdown -k 3 Look at the above snapshot, system only sends a warning and does not actually shut down. Next TopicLinux info |