|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21572/root/usr/lib/pm-utils/sleep.d/ |
Upload File : |
#!/bin/bash
. /usr/lib/pm-utils/functions
hibernate_cpufreq()
{
[ -d /sys/devices/system/cpu/ ] || return 0
pushd /sys/devices/system/cpu/ >/dev/null 2>&1
for x in $(ls -1) ; do
[ -d $x/cpufreq ] || continue
[ -f $x/cpufreq/scaling_governor ] || continue
savestate ${x}_governor $(cat $x/cpufreq/scaling_governor)
done
for x in $(ls -1) ; do
[ -d $x/cpufreq ] || continue
[ -f $x/cpufreq/scaling_governor ] || continue
gov="$TEMPORARY_CPUFREQ_GOVERNOR"
grep -q "$GOVERNOR" $x/cpufreq/scaling_available_governors \
|| gov="userspace"
sh -c "echo \"$gov\" > $x/cpufreq/scaling_governor"
done
popd >/dev/null 2>&1
}
thaw_cpufreq()
{
x=0
while :; do
gov=$(restorestate $(echo cpu${x}_governor))
[ -z "$gov" ] && break
sh -c "echo \"$gov\" > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_governor"
unset gov
x=$(($x + 1))
done
unset x
}
case "$1" in
suspend|hibernate)
hibernate_cpufreq
;;
resume|thaw)
thaw_cpufreq
;;
*)
;;
esac
exit $?