sleep_button revision 1.3
11.1Smycroft#!/bin/sh - 21.1Smycroft# 31.3Sjmcneill# $NetBSD: sleep_button,v 1.3 2006/09/26 02:17:38 jmcneill Exp $ 41.1Smycroft# 51.3Sjmcneill# Generic script for sleep button events. 61.1Smycroft# 71.1Smycroft# Arguments passed by powerd(8): 81.1Smycroft# 91.1Smycroft# device event 101.1Smycroft 111.1Smycroftcase "${2}" in 121.3Sjmcneillpressed) 131.3Sjmcneill /etc/rc.d/ntpd stop 141.3Sjmcneill /etc/rc.d/dhclient stop 151.3Sjmcneill /etc/rc.d/network stop 161.3Sjmcneill sleep 1 171.3Sjmcneill if /etc/rc.d/apmd status >/dev/null ; then 181.3Sjmcneill /usr/sbin/apm -z 191.3Sjmcneill else 201.3Sjmcneill /usr/sbin/apm -d -z 211.3Sjmcneill fi 221.3Sjmcneill # ... waking up 231.3Sjmcneill sleep 1 241.3Sjmcneill /etc/rc.d/network start 251.3Sjmcneill /etc/rc.d/dhclient start 261.3Sjmcneill /etc/rc.d/ntpdate start 271.3Sjmcneill /etc/rc.d/ntpd start 281.3Sjmcneill ;; 291.3Sjmcneillreleased) 301.3Sjmcneill # Note that we don't really need to handle a released event here, 311.3Sjmcneill # so we can gracefully exit. 321.3Sjmcneill ;; 331.1Smycroft*) 341.3Sjmcneill logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 351.1Smycroft exit 1 361.1Smycroft ;; 371.1Smycroftesac 38