1 1.1 mycroft #!/bin/sh - 2 1.1 mycroft # 3 1.3 jmcneill # $NetBSD: sleep_button,v 1.3 2006/09/26 02:17:38 jmcneill Exp $ 4 1.1 mycroft # 5 1.3 jmcneill # Generic script for sleep button events. 6 1.1 mycroft # 7 1.1 mycroft # Arguments passed by powerd(8): 8 1.1 mycroft # 9 1.1 mycroft # device event 10 1.1 mycroft 11 1.1 mycroft case "${2}" in 12 1.3 jmcneill pressed) 13 1.3 jmcneill /etc/rc.d/ntpd stop 14 1.3 jmcneill /etc/rc.d/dhclient stop 15 1.3 jmcneill /etc/rc.d/network stop 16 1.3 jmcneill sleep 1 17 1.3 jmcneill if /etc/rc.d/apmd status >/dev/null ; then 18 1.3 jmcneill /usr/sbin/apm -z 19 1.3 jmcneill else 20 1.3 jmcneill /usr/sbin/apm -d -z 21 1.3 jmcneill fi 22 1.3 jmcneill # ... waking up 23 1.3 jmcneill sleep 1 24 1.3 jmcneill /etc/rc.d/network start 25 1.3 jmcneill /etc/rc.d/dhclient start 26 1.3 jmcneill /etc/rc.d/ntpdate start 27 1.3 jmcneill /etc/rc.d/ntpd start 28 1.3 jmcneill ;; 29 1.3 jmcneill released) 30 1.3 jmcneill # Note that we don't really need to handle a released event here, 31 1.3 jmcneill # so we can gracefully exit. 32 1.3 jmcneill ;; 33 1.1 mycroft *) 34 1.3 jmcneill logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 35 1.1 mycroft exit 1 36 1.1 mycroft ;; 37 1.1 mycroft esac 38