NetBSD/etc/powerd/scripts/power_button

24 lines
410 B
Bash

#!/bin/sh -
#
# $NetBSD: power_button,v 1.1 2003/04/18 05:40:06 thorpej Exp $
#
# Generic script for power button events. We simply attempt to
# shut the system down gracefully, and let the kernel handle
# the poweroff.
#
# Arguments passed by powerd(8):
#
# device event
case "${2}" in
pressed)
/sbin/shutdown -p now
exit 0
;;
*)
echo "${0}: unsupported event ${2} on device ${1}" >&1
exit 1
;;
esac