forked from nicolargo/shinkenautoinstall
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththruk
More file actions
executable file
·57 lines (50 loc) · 1.19 KB
/
thruk
File metadata and controls
executable file
·57 lines (50 loc) · 1.19 KB
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
#! /bin/sh
### BEGIN INIT INFO
# Provides: thruk
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the thruk server
# Description: starts thruk using start-stop-daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/thruk/script/thruk_server.pl
PID=/var/run/thruk.pid
NAME=thruk
DESC=thruk
test -x $DAEMON || exit 0
# Include thruk defaults if available
if [ -f /etc/default/thruk ] ; then
. /etc/default/thruk
fi
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
$DAEMON &
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
ps -ef | grep thruk_server | grep -v grep | awk '{ print $2 }' > $PID
kill `cat $PID`
rm -f $PID
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
ps -ef | grep thruk_server | grep -v grep | awk '{ print $2 }' > $PID
kill `cat $PID`
rm -f $PID
sleep 1
$DAEMON &
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0