How to Shutdown or Restart a UNIX Machine
Even though it doesn't happen very often, there are times when we need to shutdown or restart a UNIX machine. The reasons for this can be varied; such things as a hardware upgrade would require the machine to be completely shut down. A software or BIOS upgrade may require that the machine be restarted in order to initialize. Whatever the reason, it is important to know proper procedures for the shutdown or restart of a UNIX machine.
Instructions
-
-
1
Determine if your need to do complete shutdown or a reboot. This is important. It will affect the parameters you will add to the shutdown command.
-
2
Enter the command prompt of the UNIX machine. Make sure you have authenticated as 'root' or a similarly privileged user.
-
-
3
Issue a WALL command to send a message to all connected users. You do this by typing 'wall "[message]"'; where [message] is the message you want the users to see.
-
4
Press 'Enter'. It is recommended you issue this command long enough before the shutdown to ensure users can contact you.
-
5
Type "shutdown" into the terminal. Do not press enter.
-
6
Input the shutdown parameters. If you are looking for a complete shutdown you add a "-h" (minus quotes). If you wish to have the system shutdown and immediately come back up, you would add a "-r". Press enter.
-
1
Tips & Warnings
You can set a timer to the shutdown command through the use of "-g###"; where ### is the number of seconds you want to wait before the shutdown begins.
System V does not support the "-h" argument. On System V, use "-y -i0" for a complete shutdown, and "-y -i1" for a reboot. The "-i" refers to the initialization state.
The "wall" command only sends a message to users who are currently logged into the server. If the UNIX machine in question is acting as a server, it is important that you use some other mechanism, such as a mass e-mail, to inform all users of the system of the date and time of the shutdown or reboot.
Do not do a hardware shutdown ("flipping" the power switch or unplugging the unit) unless the systems is completely unresponsive. Forcing a shutdown when the CPU is still writing data to the hard drive can and will cause data corruption.
Resources
Comments
-
oshioke
Aug 12, 2010
pls how do automate a shutdown at 6pm and start up at 8am in UNIX? what should the script look like? thanks