#!/bin/sh
#===============================================================================
#
#  busybox-acpid
#
#  Copyright (C) 2014 by Digi International Inc.
#  All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License version 2 as published by
#  the Free Software Foundation.
#
#
#  !Description: Busybox acpid bootscript
#
#===============================================================================

set -e

DAEMON="/sbin/acpid"
NAME="acpid"
DESC="Busybox ACPI daemon"
ARGS="-M /etc/acpi/acpid.map"

[ -x "${DAEMON}" ] || exit 0

case "$1" in
	start)
		echo -n "Starting $DESC: "
		start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
		echo "done"
		;;
	stop)
		echo -n "Stopping $DESC: "
		start-stop-daemon -K -q -n $NAME
		echo "done"
		;;
	restart)
		$0 stop
		$0 start
		;;
	reload)
		echo -n "Reloading $DESC: "
		killall -HUP $(basename ${DAEMON})
		echo "done"
		;;
	*)
		echo "Usage: $0 {start|stop|restart|reload}"
		exit 1
		;;
esac
