]> git.pld-linux.org Git - packages/xboxdrv.git/blob - xboxdrv.init
new package
[packages/xboxdrv.git] / xboxdrv.init
1 #!/bin/sh
2 #
3 # xboxdrv       Xbox/Xbox360 USB Gamepad Driver
4 #
5 # chkconfig:    2345 23 77
6 # description:  Xbox/Xbox360 USB gamepad driver
7
8 # Source function library.
9 . /etc/rc.d/init.d/functions
10
11 # Source xboxdrv configuration
12 . /etc/sysconfig/xboxdrv
13
14 start() {
15         # Check if the service is already running?
16         if [ ! -f /var/lock/subsys/xboxdrv ]; then
17                 msg_starting "xboxdrv"
18                 daemon /usr/bin/xboxdrv --daemon --detach --dbus system --pid-file /var/run/xboxdrv.pid $XBOXDRV_OPTIONS
19                 RETVAL=$?
20                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xboxdrv
21         else
22                 msg_already_running "xboxdrv"
23         fi
24 }
25
26 stop() {
27         if [ -f /var/lock/subsys/xboxdrv ]; then
28                 msg_stopping "xboxdrv"
29                 killproc xboxdrv
30                 rm -f /var/lock/subsys/xboxdrv
31         else
32                 msg_not_running "xboxdrv"
33         fi
34 }
35
36 condrestart() {
37         if [ -f /var/lock/subsys/xboxdrv ]; then
38                 stop
39                 start
40         else
41                 msg_not_running "xboxdrv"
42                 RETVAL=$1
43         fi
44 }
45
46 RETVAL=0
47 # See how we were called.
48 case "$1" in
49   start)
50         start
51         ;;
52   stop)
53         stop
54         ;;
55   restart)
56         stop
57         start
58         ;;
59   try-restart|condrestart)
60         condrestart 0
61         ;;
62   force-reload)
63         condrestart 7
64         ;;
65   status)
66         status xboxdrv
67         exit $?
68         ;;
69   *)
70         msg_usage "$0 {start|stop|restart|try-restart|force-reload|condrestart|status}"
71         exit 3
72 esac
73
74 exit $RETVAL
This page took 0.157967 seconds and 3 git commands to generate.