/usr/share/doc/apcupsd/examples/offbattery.cpufreq is in apcupsd-doc 3.14.10-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/bin/sh
#
# This shell script if placed in /etc/apcupsd will be
# called by /etc/apcupsd/apccontrol when the UPS goes
# back on to the mains after a power failure.
#
# We scale the CPU clock frequency to maximum and
# send an email message to root to notify him.
#
# NOTE: Assumes Linux-2.6.x kernel with CPUFREQ
# support for your chipset.
SYSADMIN=root
APCUPSD_MAIL="/bin/mail"
# Iterate over all CPUs, enabling the userspace governor
# and programming the current clock speed to the maximum.
# This is redundant on hyperthread siblings, but it
# doesn't hurt anything and it keeps the code simple.
for CPU in /sys/devices/system/cpu/cpu*/cpufreq ; do
echo -n userspace > $CPU/scaling_governor
cat $CPU/scaling_max_freq > $CPU/scaling_setspeed
done
# Send an email to root
HOSTNAME=`hostname`
MSG="$HOSTNAME Power has returned"
#
(
echo "Subject: $MSG"
echo " "
echo "$MSG"
echo " "
for CPU in `ls -1 /sys/devices/system/cpu` ; do
echo -n "$CPU freq scaled to "
cat /sys/devices/system/cpu/$CPU/cpufreq/scaling_setspeed | tr -d '\n'
echo " MHz"
done
echo " "
/sbin/apcaccess status
) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
exit 0
|