xref: /netbsd-src/etc/powerd/scripts/power_button (revision 6f4bc2c87703ff4ee1175804219da14a23f25fa0)
1e45c3964Sthorpej#!/bin/sh -
2e45c3964Sthorpej#
3*6f4bc2c8Smycroft#	$NetBSD: power_button,v 1.3 2003/11/01 23:04:54 mycroft Exp $
4e45c3964Sthorpej#
5e45c3964Sthorpej# Generic script for power button events.  We simply attempt to
6e45c3964Sthorpej# shut the system down gracefully, and let the kernel handle
7e45c3964Sthorpej# the poweroff.
8e45c3964Sthorpej#
9e45c3964Sthorpej# Arguments passed by powerd(8):
10e45c3964Sthorpej#
11e45c3964Sthorpej#	device event
12e45c3964Sthorpej
13e45c3964Sthorpejcase "${2}" in
14e45c3964Sthorpejpressed)
15*6f4bc2c8Smycroft	/sbin/shutdown -p now "power button pressed"
16e45c3964Sthorpej	exit 0
17e45c3964Sthorpej	;;
18e45c3964Sthorpej
19e45c3964Sthorpej*)
201455475aSmycroft	logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
21e45c3964Sthorpej	exit 1
22e45c3964Sthorpej	;;
23e45c3964Sthorpejesac
24