Stopping Unix



next up previous contents index
Next: Restarting Your Workstation Up: Shutting Down and Previous: Shutting Down and

Stopping Unix

Unix machines should go through a shutdown procedure before they are powered down or rebooted. There are a number of reasons for this. One is that many background processes need to be properly terminated so they can remove locks from files or update logs. An even more important reason is that Unix keeps up the inode table, that is, a table of file names and their locations on the disks. A copy of the table is always in memory while Unix is running, and before shutting off the inode table must be written out to disk. This operation is called a sync and is done automatically every 30-60 seconds. If the machine is powered down without ``syncing,'' Unix may loose track of some files. This could lead to an unpleasant situation for system and user when the system is powered up again. Specifically, while blocks of disk space may be allocated for files, there will be no listing in the inode table of where to put them. Alternatively, there may be a listing in the inode table giving the file names, but not the information needed to allocate blocks to the files. In either case you have a ``corrupted'' file system, and you may need to use fsck (described soon) to fix it. 

In case we have not been clear enough, we repeat:
Do not just turn off the power to your workstation when you are done working.
In fact, it is best to leave the power on all the time, unless you will be gone for extended periods or if safety, severe storms, or power irregularities are a consideration. A reason not to power down is that there may be jobs or programs waiting to run at night when they will affect other jobs the least, or other machines may try to deliver mail to your machine at anytime, or your machine may be part of a network which relies on your computer for service. And of course, if other users are sharing your facilities, they will be excluded (and probably turned off to you) if you power down.

To properly shut the system down, you must have superuser (root) authority and issue

the shutdown command. The options and form of the shutdown command vary. On BSD or Sun machines, issuing shutdown now sends a warning to every user logged into the machine and then shuts the system down. In contrast, on System V and AIX machines, this is done by issuing shutdown. All versions allow you to specify a future time for the shutdown, as well as warn users currently logged on that the system is about to go down. The warning gets repeated at more frequent intervals as shutdown time approaches. 

On System V the shutdown procedure is something like this:

login: root   	Sign on as root at the console.    
# shutdown   	Enter the shutdown command.   
Broadcast Message from root (ttyp00) on ns99   	   
The system will be shut down in 60 seconds.   	   
Please log off now.   	And then it repeats.   
Do you want to continue? (y or n): y   	   
Shutdown Complete   	Wait for this before turning off.   



next up previous contents index
Next: Restarting Your Workstation Up: Shutting Down and Previous: Shutting Down and