MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/lib/pm-utils/sleep.d/94cpufreq
#!/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 $?