MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /usr/local/src/apcupsd-3.14.10/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/src/apcupsd-3.14.10/examples/offbattery.cpufreq
#!/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


Anon7 - 2021