PommedInitscript

From Mactel-Linux

Jump to: navigation, search
#!/bin/bash
#
# pommed	Activate hotkeys on Apple laptops
#
# chkconfig: 2345 95 10
# description: Activate hotkeys on Apple laptops
#
### BEGIN INIT INFO
# Provides: pommed
# Default-Start: 2 3 4 5
# Short-Description: Activate hotkeys on Apple laptops
# Description: Activate hotkeys on Apple laptops
### END INIT INFO

#Servicename
SERVICE=pommed

# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0

case "$1" in
	start)
	gprintf "Starting %s: " "$SERVICE"
	if [ -e /var/lock/subsys/$SERVICE ]; then
		failure
		echo
		gprintf "Pommed already enabled!\n"
		exit 1
	fi
	/usr/sbin/pommed &>/dev/null
	RETVAL=$?
	success
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
	;;
    	stop)
	gprintf "Stopping %s: " "$SERVICE"
	if ! [ -e /var/lock/subsys/$SERVICE ]; then
		failure
		echo
		gprintf "Pommed already disabled!\n"
		exit 1
	fi
	killproc /usr/sbin/pommed
	RETVAL=$?
	success
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
	;;
	status)
	if [ -e /var/lock/subsys/$SERVICE ]; then
		gprintf "Pommed is enabled\n"
	else
		gprintf "Pommed is disabled\n"
	fi
	;;
	restart|reload)
	$0 stop
	$0 start
	;;
	*)
	gprintf "Usage: %s {start|status|stop}\n" "$SERVICE"
	exit 1
esac

exit $RETVAL
Personal tools