[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 4

rc.powerfail Command

Purpose

Shuts down a system when a power failure is detected.

Syntax

rc.powerfail [ -h ] | [ [ -s ] [ -t [ mm ] ] ]

Description

Power related events are handled by the rc.powerfail script to achieve graceful shutdown of the operating system whenever possible. Note that if a critical power failure condition occurs and if battery backup is present, the operating system can take certain actions before the battery drains.

The rc.powerfail command is started by the /etc/inittab file when init receives a SIGPWR signal from the kernel. The rc.powerfail command first calls the machstat command to determine the state of the system. The rc.powerfail command should be called only when a power failure or fan fault has occurred.

In the case of a severe failure without any form of backup power supply, the rc.powerfail command is given approximately 20 seconds prior to halting the system. The severe failure situations include loss of primary power, thermal high, internal failure, or power supply overload. In these cases, rc.powerfail warns the users currently logged on to the system and then immediately halts the system.

In case of a critical failure, the rc.powerfail command waits approximately 10 minutes before starting the shut down of the system. The user can alter this time by using the -t option on the /etc/inittab file powerfail entry. Prior to the last 60 seconds, logged-on users are sent messages telling them how much time remains until shutdown. If a shutdown is NOT desired, the user may add the -s option to the command in the /etc/inittab file.

Flags

-h Gives an information message containing the power status codes and the resulting action.
-s Does not do a system shutdown if there is a power failure in systems with either a battery backup or fan fault. The logged-on users still receive all the appropriate messages, but the actual system shutdown is left up to the system administrator. This flag has no effect if a critical power failure is detected.
-tmm Gives the number of whole minutes until system shutdown in the case of a primary power loss with battery backup or fan fault. This number should be equal to half the length of time guaranteed by the battery backup. This flag has no effect if a critical power failure is detected.

Exit Status

If the system shuts down, no exit value is returned. Otherwise, the rc.powerfail command returns the following exit values:

0 Normal condition.
1 Syntax error.
2 halt -q failed
3 shutdown -F failed.
4 An error has occurred. Shut your system down immediately using shutdown -F.
5 An undefined state. Call your Service Representative.

Security

Access Control: root only.

Examples

  1. The various messages related to power status codes can be displayed by invoking rc.powerfail as follows:

    rc.powerfail -h
  2. To block system shutdown when non-critical power failures or fan faults occur, enter:

    chitab "powerfail::powerfail:/etc/rc.powerfail -s >dev/console 2>&1"

    The next SIGPWR received by init will NOT cause a system shutdown if a non-critical power failure occurs.

  3. To change the time until shutdown to 30 minutes, enter:

    chitab "powerfail::powerfail:/etc/rc.powerfail -t 2 >/dev/console 2>&1"

    The next critical SIGPWR received by init will have a 2 minute delay until system shutdown.

Files

/etc/inittab Controls the initialization process.

Related Information

The machstat command, init command, chitab command, halt command, shutdown command.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]