Chad Walstrom wrote:
> One thing I thought about last week was the use of runtime levels to
> switch your laptop into different modes of operation. For example,
> runlevel 2 (default on Debian) could be used for normal, AC power
> operation. Switch to RL 3 for low-power consumption, etc.
I used to do just that when I ran RedHat on a laptop. It worked quite
well.
Running Debian now, I created /etc/apm/event.d/noflushd to stop services
that make the disk spin up (cron, at, sendmail, etc). The script runs
automatically when I switch from AC to battery or vice versa. This
seemed more efficient to me as the system just handles it automatically
and I don't have to remember to switch runlevels. You need to have the
noflushd package installed. No warranty, use at your own risk, blah
blah blah...
-----cut here---------
#!/bin/sh
# /etc/apm/event.d/noflushd
# 4-Aug-2003 SWJ - only run noflushd when on battery power
# this whole script is my creation.
test -x /usr/sbin/noflushd || exit 0
case "$1,$2" in
change,power|resume,*)
# power status change; figure out if we're on ac or battery
/usr/bin/on_ac_power
RET="$?"
case "$RET" in
0)
# on ac power
# don't run noflushd, start other services
/etc/init.d/atd start
/etc/init.d/cron start
/etc/init.d/sendmail start
/etc/init.d/noflushd stop
;;
1)
# on battery
# stop services that spin up the disk, run noflushd
/etc/init.d/atd stop
/etc/init.d/cron stop
/etc/init.d/sendmail stop
/etc/init.d/noflushd start
;;
255)
echo "Power status could not be determine (error=255)"
exit 255
;;
*)
echo "unknown error; ret=[$RET]"
exit 1
esac
;;
esac
-----cut here---------
--
scot
_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
Help beta test TCLUG's potential new home: http://plone.mn-linux.org
Got pictures for TCLUG? Beta test http://plone.mn-linux.org/gallery
tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list