#!/bin/dash
# Start olpc-switchd, XO power management even daemon
# $1 - start, stop, restart

case $1 in
	start) 
		/usr/sbin/olpc-switchd -f -l -p 10 -F /var/run/powerevents & 
		;;
	stop)
		kill -9 $(pidof olpc-switchd)
		;;
	restart) 
		${0} stop && sleep 1 && ${0} start 
		;;
	status) 
		pidof olpc-switchd > /dev/null && echo "olpc-switchd is running" || "olpc-switchd is stopped."
		;;
esac
