-
Notifications
You must be signed in to change notification settings - Fork 7
/
initd_jenkins_confirm
executable file
·70 lines (64 loc) · 1.56 KB
/
initd_jenkins_confirm
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# /etc/init.d/jenkins_confirm
# Debian on Raspberry Pi compatible XFD startup script, Device Discovery Server.
#
### BEGIN INIT INFO
# Provides: jenkins_confirm_server
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start XFD Jenkins Confirm at boot time
# Description: Jumpstarts the heart of the Switch-Gears.dk eXtreme Feedback Device.
### END INIT INFO
DESC="Gitgear.com eXtreme Feedback Device Jenkins Confirm Server"
NAME=jenkins_confirm
SCRIPTNAME=/etc/init.d/$NAME
PIDFILE=/tmp/xfd/jenkins_confirm.pid
if [ `id -u` -ne 0 ]; then
echo "The $NAME init script can only be run as root"
exit 1
fi
do_start()
{
mkdir -p $(dirname $PIDFILE)
rm -f $PIDFILE
sudo /home/pi/extremefeedbacklamp/jenkins_confirm.py &
echo -n $! > $PIDFILE
}
do_stop()
{
if [ -f $PIDFILE ]; then
kill `cat $PIDFILE`
fi
}
case "$1" in
start)
echo "Starting $NAME"
do_start
;;
stop)
echo "Stopping $NAME"
do_stop
;;
restart)
echo "Stopping $NAME"
do_stop
do_start
;;
status)
if [ -f $PIDFILE ]; then
echo "XFD Jenkins Confirm Server (should be) running with PID:"
cat $PIDFILE
echo ""
else
echo "XFD Jenkins Confirm Server not running (or not started through init.d)"
fi
;;
*)
echo "Usage: /etc/init.d/switchgearsXFDJenkinsConfirmServer {start|stop|status|restart}"
exit 1
;;
esac
exit 0