Shutdown

From OnnoWiki
Jump to navigation Jump to search

Dari: http://linux.101hacks.com/unix/shutdown/


What is shutdown?

Shutdown the system in a safe way. You can shutdown the machine immediately, or schedule a shutdown using 24 hour format.

After bringing down the system, shutdown command halts or reboots the system according to the option that is specified. Only root user can execute shutdown command.

5 shutdown Examples Shutdown the machine immediately

You can shutdown the machine immediately using the following command. It notifies all the logged in users about the system going down, and shuts down the machine.

  1. shutdown -h now

Broadcast message from sathiya@sathiya-laptop (/dev/pts/1) at 11:28 ...

The system is going down for halt NOW!

Reboot the machine immediately

You can reboot the machine immediately using the following command. It notifies all the logged in users about the system reboot.

  1. shutdown -r now

Broadcast message from sathiya@sathiya-laptop (/dev/pts/1) at 11:28 ...

The system is going down for reboot NOW!

Shutdown the machine with user defined message

You can also displays your own custom shutdown message. Along with the system message, your message will be appended in the broadcast as shown below.

  1. shutdown -h now 'System is going down for replacement of primary memory'

Broadcast message from sathiya@sathiya-laptop (/dev/pts/1) at 11:28 ...

The system is going down for halt NOW! System is going down for replacement of primary memory

Scheduling the shutdown with 24 hour format

Schedule shutdown for 8 PM.

  1. shutdown -h 20:00

It sends the following message immediately to all terminals.

Broadcast message from sathiya@sathiya-laptop (/dev/pts/3) at 10:25 ...

The system is going down for halt in 575 minutes!

Similar to shutdown (halt), you also schedule a reboot at a specified time as shown below.

  1. shutdown -r 20:00

Broadcast message from sathiya@sathiya-laptop (/dev/pts/3) at 10:27 ...

The system is going down for reboot in 573 minutes!

Cancel a running shutdown

You can cancel the running shutdown by using -c option as,

  1. shutdown -c

Syntax and Options

shutdown [OPTION]… TIME [MESSAGE] Short Option Option Description -r Requests that the system be rebooted after it has been brought down -h Requests that the system be either halted or powered off after it has been broughtdown, with the choice as to which left up to the system -H Requests that the system be halted after it has been brought down -P Requests that the system be powered off after it has been brought down -c Cancels a running shutdown. TIME is not specified with this option, the firstargument is MESSAGE -k Only send out the warning messages and disable logins, do not actually bring thesystem down





Referensi