Shuts down a system when a power failure is detected.
rc.powerfail [ -h ] | [ [ -s ] [ -t [ mm ] ] ]
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 critical power failure without any form of backup power supply, the rc.powerfail command is given approximately 20 seconds prior to shut down of the system. These critical situations are 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.
If there is a fan fault or if a battery backup power supply is attached to the system, the rc.powerfail command is given approximately 15 minutes prior to 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 at any time in the last 60 seconds the fan fault clears, the system shutdown halts and the users are notified that all errors have cleared. If a shutdown is NOT desired, the user may add the -s option to the command in the /etc/inittab file.
|-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.|
If the system shuts down, no exit value is returned. Otherwise, the rc.powerfail command returns the following exit values:
|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.|
Access Control: root only.
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.
chitab "powerfail::powerfail:/etc/rc.powerfail -t 30 >/dev/console 2>&1"The next SIGPWR received by init will have a 30 minute delay until system shutdown if the condition is not critical.
|/etc/inittab||Controls the initialization process.|
The machstat command, init command, chitab command, halt command, shutdown command.