3 # This shell script if placed in /etc/apcupsd will be
4 # called by /etc/apcupsd/apccontrol when the UPS goes
5 # back on to the mains after a power failure.
7 # We scale the CPU clock frequency to maximum and
8 # send an email message to root to notify him.
10 # NOTE: Assumes Linux-2.6.x kernel with CPUFREQ
11 # support for your chipset.
13 APCUPSD_MAIL
="/bin/mail"
15 # Iterate over all CPUs, enabling the userspace governor
16 # and programming the current clock speed to the maximum.
17 # This is redundant on hyperthread siblings, but it
18 # doesn't hurt anything and it keeps the code simple.
19 for CPU
in /sys
/devices
/system
/cpu
/cpu
*/cpufreq
; do
20 echo -n userspace
> $CPU/scaling_governor
21 cat $CPU/scaling_max_freq
> $CPU/scaling_setspeed
24 # Send an email to root
26 MSG
="$HOSTNAME Power has returned"
33 for CPU
in `ls -1 /sys/devices/system/cpu` ; do
34 echo -n "$CPU freq scaled to "
35 cat /sys
/devices
/system
/cpu
/$CPU/cpufreq
/scaling_setspeed |
tr -d '\n'
39 /sbin
/apcaccess status
40 ) |
$APCUPSD_MAIL -s "$MSG" $SYSADMIN