d54c2134a8
sleep_button events. These use the /dev/apm interface, so should be useful on more than just i386.
38 lines
702 B
Bash
Executable File
38 lines
702 B
Bash
Executable File
#!/bin/sh -
|
|
#
|
|
# $NetBSD: sleep_button,v 1.3 2006/09/26 02:17:38 jmcneill Exp $
|
|
#
|
|
# Generic script for sleep button events.
|
|
#
|
|
# Arguments passed by powerd(8):
|
|
#
|
|
# device event
|
|
|
|
case "${2}" in
|
|
pressed)
|
|
/etc/rc.d/ntpd stop
|
|
/etc/rc.d/dhclient stop
|
|
/etc/rc.d/network stop
|
|
sleep 1
|
|
if /etc/rc.d/apmd status >/dev/null ; then
|
|
/usr/sbin/apm -z
|
|
else
|
|
/usr/sbin/apm -d -z
|
|
fi
|
|
# ... waking up
|
|
sleep 1
|
|
/etc/rc.d/network start
|
|
/etc/rc.d/dhclient start
|
|
/etc/rc.d/ntpdate start
|
|
/etc/rc.d/ntpd start
|
|
;;
|
|
released)
|
|
# Note that we don't really need to handle a released event here,
|
|
# so we can gracefully exit.
|
|
;;
|
|
*)
|
|
logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
|
|
exit 1
|
|
;;
|
|
esac
|