HP-UX System Administrator's Guide: Routine Management Tasks
NOTE: You must have permission to shut down an HP-UX system! Obviously, this
command can have serious consequences and is therefore to be used with caution.
It is not a command that everyone should be able to use.
Permission to shut down the system is normally reserved for superusers only.
However, there is a mechanism that you can use to assign permission to other
users so that they can shut down the system should the need arise when a superuser
is not around. The /etc/shutdown.allow file enables superusers to specify
who has permission to shut down the system in their absence. For details, see the
shutdown(1M) manpage.
When run, shutdown ensures an orderly shutdown of the system by doing the
following:
• Resets the PATH environment variable to the value:
/usr/bin:/usr/sbin:/sbin
• Resets the IFS environment variable to the value:
space tab newline
• Verifies that the user attempting to shut down the system has permission to do so
(checks the /etc/shutdown.allow file).
• Changes the current working directory to the root directory (/).
• Runs the sync command to be sure that file system changes still in memory are
updated in the superblocks and file system structures on disk. This is one of
shutdown’s most important functions!
• Sets the real user ID to that of the superuser (see setuid(2) for information on user
IDs).
• Sends a broadcast message to all users currently logged in to the system telling
them that the system is about to be shut down. There is a default broadcast message,
but you can specify your own if you prefer.
• /sbin/rc is executed to shut down subsystems, unmount file systems, and
perform other tasks to bring the system to run level 0, where it is safe to power off
your system if you do not plan to immediately reboot it.
• Finally, if you are not shutting down your system down to single-user mode (see
Example 2-29 (page 87)), the program /sbin/reboot is executed to halt your
system or reboot it if the -h or -r option (respectively) was specified.
Power Failure
Not every shutdown can be planned for. An unexpected power failure is an example
of an unplanned shutdown.
88 Booting and Shutdown