Changes

From SME Server
Jump to navigationJump to search
NMC killpower requirements
Line 89: Line 89:  
Continue as above in the ''Configure apcupsd'' section - but note the requirements in the ''snmp and pcnet Killpower'' section below.
 
Continue as above in the ''Configure apcupsd'' section - but note the requirements in the ''snmp and pcnet Killpower'' section below.
 
=====snmp and pcnet Killpower=====
 
=====snmp and pcnet Killpower=====
 +
The standard rpm install copies the ''/etc/init.d/halt'' script to ''/etc/init.d/halt.old'' and then inserts the following code fragment near the end just after the file systems are remounted read only.
 +
# See if this is a powerfail situation.                              # ***apcupsd***
 +
if [ -f /etc/apcupsd/powerfail ]; then                                # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "APCUPSD will now power off the UPS"                          # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    /etc/apcupsd/apccontrol killpower                                  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***
 +
    echo "Otherwise, the UPS may cut the power during the reboot!!!"  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
fi                                                                    # ***apcupsd***
    +
Thus for normal operation with a USB or serial cable, a killpower instruction is sent to the UPS just before the server powers down. The UPS then waits for the DSHUTD (Delayed shutdown) period (usually 60 or 90 seconds) and powers off, by which time the final server shutdown and power off should be complete.
 +
 +
With the ''snmp'' and ''pcnet'' UPSTYPE however, communication is across the network and the ''/etc/init.d/halt'' script will have killed the network service before the above code instructs the UPS to power down. In order for the UPS to receive a ''killpower'' signal therefore it is necessary to edit ''/etc/init.d/halt'' and move the code fragment shown above to nearer the beginning of the script, inserting it as below.
 +
case "$1" in
 +
    *start)
 +
        ;;
 +
    *)
 +
        echo $"Usage: $0 {start}"
 +
        exit 1
 +
        ;;
 +
esac
 +
 +
# See if this is a powerfail situation.                              # ***apcupsd***
 +
if [ -f /etc/apcupsd/powerfail ]; then                                # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "APCUPSD will now power off the UPS"                          # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    /etc/apcupsd/apccontrol killpower                                  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***
 +
    echo "Otherwise, the UPS may cut the power during the reboot!!!"  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
fi                                                                    # ***apcupsd***
 +
 +
# Kill all processes.
 +
[ "${BASH+bash}" = bash ] && enable kill
 +
 +
runcmd $"Sending all processes the TERM signal..." /sbin/killall5 -15
 +
sleep 5
 +
runcmd $"Sending all processes the KILL signal..."  /sbin/killall5 -9
 +
 +
The UPS will therefore be instructed to power down before the network service is terminated.
 +
 +
This is much earlier in the server shutdown process however and it is important to set the shutdown delay to at least 180 seconds i.e. greater than the time it actually takes your SME server to shutdown following a halt signal. Therefore via the NMC web browser interface goto the ''UPS'' tab and under ''Configuration - Shutdown'' select the appropriate value for ''Shutdown Delay'' of 180 seconds or greater.
 
===Usage of apcupsd===
 
===Usage of apcupsd===
 
The file ''/etc/apcupsd/apcupsd.conf'' controls the configuration of the apcupsd daemon and is well documented. In addition to this ''/etc/apcupsd/apccontrol'' is called by the daemon whenever a UPS event occurs, and determines the standard action taken. User configurable actions can be taken by creating/editing files in /etc/apcupsd with names corresponding to relevant events, and these are called first by ''apccontrol''. For example, a file called ''onbattery'' will be called by ''apccontrol'' whenever an ON BATTERY event occurs, and if ''onbattery'' returns an exit code of 99, then ''apccontrol'' will not take its own default action.
 
The file ''/etc/apcupsd/apcupsd.conf'' controls the configuration of the apcupsd daemon and is well documented. In addition to this ''/etc/apcupsd/apccontrol'' is called by the daemon whenever a UPS event occurs, and determines the standard action taken. User configurable actions can be taken by creating/editing files in /etc/apcupsd with names corresponding to relevant events, and these are called first by ''apccontrol''. For example, a file called ''onbattery'' will be called by ''apccontrol'' whenever an ON BATTERY event occurs, and if ''onbattery'' returns an exit code of 99, then ''apccontrol'' will not take its own default action.

Navigation menu