#!/bin/sh # # xboxdrv Xbox/Xbox360 USB Gamepad Driver # # chkconfig: 2345 23 77 # description: Xbox/Xbox360 USB gamepad driver # Source function library. . /etc/rc.d/init.d/functions # Source xboxdrv configuration . /etc/sysconfig/xboxdrv start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/xboxdrv ]; then msg_starting "xboxdrv" daemon /usr/bin/xboxdrv --daemon --detach --dbus system --pid-file /var/run/xboxdrv.pid $XBOXDRV_OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xboxdrv else msg_already_running "xboxdrv" fi } stop() { if [ -f /var/lock/subsys/xboxdrv ]; then msg_stopping "xboxdrv" killproc xboxdrv rm -f /var/lock/subsys/xboxdrv else msg_not_running "xboxdrv" fi } condrestart() { if [ -f /var/lock/subsys/xboxdrv ]; then stop start else msg_not_running "xboxdrv" RETVAL=$1 fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart|condrestart) condrestart 0 ;; force-reload) condrestart 7 ;; status) status xboxdrv exit $? ;; *) msg_usage "$0 {start|stop|restart|try-restart|force-reload|condrestart|status}" exit 3 esac exit $RETVAL