shutdown(1M)
NAME
shutdown − terminate all processing
SYNOPSIS
/etc/shutdown [-h | -r] [−d device] [−f lif_file] [-y] [grace]
DESCRIPTION
shutdown is part of the HP-UX system operation procedures. Its primary function is to terminate all currently running processes in an orderly and cautious manner. shutdown can be used to put the system in single-user mode for administrative purposes such as backup or file system consistency checks (see fsck(1M)), and to halt or reboot the system. By default, shutdown is an interactive program.
Options
-h Shut down the system and halt.
-r Shutdown the system and reboot automatically.
-d device (Series 300 and 400 only) Reboot from the specified device. The device must be a LIF volume. The -d option can only be used with the -r option.
-f lif_file (Series 300 and 400 only) Reboot from the specified file. If lif_file is a pair of double quotes indicating an empty string (i.e., -f ""), a power-up search sequence is performed to find a system. Otherwise, lif_file must follow the LIF filename convention. The -f option can only be used with the -r option, and a space is required between the -f and its argument.
-y Do not require any interactive responses from the user. (Respond yes or no as appropriate to all questions, such that the user does not interact with the shut-down process.)
grace grace specifies, in seconds, a grace period for users to log off before the system shuts down. The default is 60 seconds. If grace is zero, shutdown runs more quickly, giving users very little time to log out.
If neither -r (reboot) or -h (halt) is specified, the system is placed in run-level s; see init(1M).
shutdown goes through the following steps:
• The PATH environment variable is reset to /bin and /usr/bin.
• The IFS environment variable is reset to space, tab, and newline.
• The user is checked for authorization to execute the shutdown command (only authorized users can execute the shutdown command; see FILES for more information on the /etc/shutdown.allow authorization file.)
• The current working directory is changed to the root directory (/).
• All file systems’ super blocks are updated; see sync(1M). This must be done before rebooting the system to ensure file system integrity.
• The real user ID is set to that of the super-user.
• A broadcast message is sent to all users currently logged in on the system telling them to log out. The administrator can specify a message at this time; otherwise, a standard warning message is displayed.
• User-supplied custom scripts in the /etc/shutdown.d directory are executed. See FILES for more information on this directory.
• The accounting subsystem is shut down.
• The next step depends on which options are selected:
• If the system is being halted or rebooted and it is not a mirrored disc system or an auxiliary swap server with a local mounted file system, /etc/reboot is executed to finish bringing down the system.
• If the system is being brought down to single-user state or is a mirrored disc system or is an auxiliary swap server with a local mounted file system, the following steps occur:
• All currently executing processes are terminated (see killall(1M)).
• The auditing subsystem is turned off.
• All locally mounted file systems are unmounted.
The system is rebooted or halted by executing /etc/reboot if the -h or -r option was chosen. If the system was being brought down to single-user state, a signal is sent to the init process to change states (see init(1M)).
In the HP Clustered environment, executing shutdown on the cluster server of a cluster causes all cluster nodes to also shut down. Executing shutdown on an auxiliary swap server causes all swap clients to be shut down as well as the swap server.
Each cluster node is shut down by executing /etc/reboot locally.
If neither -h nor -r is specified from the root or auxiliary swap server, the client machines are still rebooted. Note that prior to executing /etc/reboot on each cluster node, the remote boot daemon on the root or auxiliary swap server is disabled. Thus, client cluster nodes cannot actually reboot until the remote boot daemon (rbootd) is enabled on the root or auxiliary swap server.
Executing shutdown on a client node which is not also an auxiliary swap server only affects that node.
DIAGNOSTICS
device busy
This is the most commonly encountered error diagnostic, and happens when a particular file system could not be unmounted; see mount(1M).
user not allowed to shut down this system
User is not authorized to shut down the system. User and system must both be included in the authorization file /etc/shutdown.allow.
EXAMPLES
Immediately reboot the system and run HP-UX again:
shutdown -r 0
Halt the system in 5 minutes (300 seconds) with no interactive questions and answers:
shutdown -h -y 300
Go to init run-level s in 10 minutes:
shutdown 600
FILES
/etc/shutdown.allow Authorization file for /etc/shutdown. Lines consist of a system hostname and the login name of a user authorized to reboot or halt the system. The super-user’s login name must be included in this file in order to execute shutdown. However, if the file is missing or of zero length, the root user can run the shutdown program to bring the system down. This file does not affect authorization to bring the system down to single-user state for maintenance purposes; that operation is permitted only when invoked by the super-user.
A comment character, #, at the beginning of the line causes the rest of the line to be ignored (comments cannot span multiple lines without additional comment characters). Blank lines are also ignored.
A subset of the wildcards available in hosts.equiv are available in the shutdown.allow file (see hosts.equiv(4)). Specifically the % (all nodes in the cluster) and + (all hosts or all users) wildcards are available. The % wildcard is not valid for standalone systems. Example entries:
# user1 can shut down systemA and systemB
systemA user1
systemB user1
# root can shut down the whole cluster
% root
# Anybody can shut down systemC
systemC +
/etc/shutdown.d Directory for user-supplied scripts that are needed to gracefully shut down the system. Files in this directory are executed in machine-sequence (ASCII) order. Files whose names begin with a dot, subdirectories, and files in subdirectories are ignored by the shutdown process.
One way to control the order of execution of these files is to prefix numbers onto the file names. For example:
0010StopAppA
0030StopAppD
0100StopAppB
These names cause 0010StopAppA to be executed first, followed by 0030StopAppD, then 0100StopAppB.
Files are executed using the Bourne shell. shutdown sets the environment for executing scripts as follows:
• PATH variable is set to /bin and /usr/bin,
• IFS variable is set to space, tab, and newline,
• Current working directory is the root directory,
• Real user ID is that of the super-user.
Permissions on the /etc/shutdown.d directory should not be changed, and careful control of this directory should be maintained in order to ensure system integrity.
DEPENDENCIES
Series 700 and 800
The -d and -f options are not supported.
WARNINGS
The user name compared with the entry in the shutdown.allow file is obtained using getlogin() or, if that fails, using getpwuid() (see getlogin(3) and getpwuid(3)).
The hostname in /etc/shutdown.allow is compared with the hostname obtained using gethostbyname() (see gethostbyname(3)).
shutdown must be executed from a directory on the root volume, such as the / directory.
The maximum broadcast message that can be sent is approximately 970 characters.
The maximum full pathname to scripts in the /etc/shutdown.d directory is 255 characters. Given the directory name, this means that file names in the directory must be shorter than 239 characters.
SEE ALSO
fsck(1M), init(1M), killall(1M), mount(1M), rbootd(1M), reboot(1M), sync(1M), gethostbyname(3), getpwuid(3), hosts.equiv(4).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992