|
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/21573/root/usr/lib/pm-utils/power.d/ |
Upload File : |
#!/bin/bash
# Values are taken from the laptop-tools package
# Bart Samwel <bart@samwel.tk>
. /usr/lib/pm-utils/functions
setlowpowermode()
{
# Seconds laptop mode has to to wait after the disk
# goes idle before doing a sync.
echo $DISK_IDLE_SECS > /proc/sys/vm/laptop_mode
# Set dirty page values
echo $DIRTY_WRITEBACK > /proc/sys/vm/dirty_writeback_centisecs
echo $DIRTY_EXPIRE > /proc/sys/vm/dirty_expire_centisecs
# Dirty synchronous ratio. At this percentage of dirty
# pages the process which calls write() does its own writeback.
echo $DIRTY_RATIO > /proc/sys/vm/dirty_ratio
# Allowed dirty background ratio, in percent.
# Once DIRTY_RATIO has been exceeded, the kernel will wake pdflush
# which will then reduce the amount of dirty memory to
# dirty_background_ratio. Set this nice and low, so once some
# writeout has commenced, we do a lot of it.
echo $DIRTY_BACKGROUND_RATIO > /proc/sys/vm/dirty_background_ratio
}
if [ ! -d "/proc/sys/vm/" ] ; then
# Use the raw kernel sysfs interface
echo "The required directory /proc/sys/vm/ doesn't exist"
exit 1
fi
if ! [ -w "/proc/sys/vm/laptop_mode" -a -w "/proc/sys/vm/dirty_writeback_centisecs" -a -w "/proc/sys/vm/dirty_expire_centisecs" -a -w "/proc/sys/vm/dirty_ratio" -a -w "/proc/sys/vm/dirty_background_ratio" ] ; then
# Use the raw kernel sysfs interface
echo "You do not have write access to files in /proc/sys/vm/"
exit 1
fi
case "$1" in
true)
echo "**SetLowPower ON"
DISK_IDLE_SECS=2
DIRTY_WRITEBACK=30
DIRTY_EXPIRE=30
DIRTY_RATIO=60
DIRTY_BACKGROUND_RATIO=1
setlowpowermode
;;
false)
echo "**SetLowPower OFF"
DISK_IDLE_SECS=0
DIRTY_WRITEBACK=500
DIRTY_EXPIRE=3000
DIRTY_RATIO=40
DIRTY_BACKGROUND_RATIO=10
setlowpowermode
;;
*)
;;
esac
exit $?