-
Notifications
You must be signed in to change notification settings - Fork 55
/
init_script
executable file
·47 lines (42 loc) · 1.11 KB
/
init_script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
#
# spacenavd free driver for 3Dconnexion 6dof devices
#
# chkconfig: 2345 99 99
# description: A free user space driver for 3Dconnexion input devices,\
# compatible with the proprietary 3dxsrv daemon.
#
#
### BEGIN INIT INFO
# Provides: spacenavd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: free driver for 3Dconnexion 6dof devices
# Description: A free user space driver for 3Dconnexion input devices, compatible with the proprietary 3dxsrv daemon.
### END INIT INFO
DAEMON=/usr/local/bin/spacenavd
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
echo 'Starting spacenavd daemon'
$DAEMON -v
;;
stop)
echo 'Stopping spacenavd daemon'
# detect daemon's process id
pid=`cat /var/run/spnavd.pid 2>/dev/null`
if [ $? != 0 ]; then
pid=`ps -e | grep spacenavd | awk '{ print $1 }'`
if [ -z "$pid" ]; then
echo 'spacenavd daemon is not running, nothing to do.'
exit 1
fi
fi
kill $pid
;;
reload|restart|force-reload)
$0 stop && sleep 1 && $0 start
;;
esac