-
Notifications
You must be signed in to change notification settings - Fork 2
/
logio-harvester
65 lines (55 loc) · 1.03 KB
/
logio-harvester
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
#!/bin/bash
#
# Startup script for Log.io Harvester
#
# chkconfig: - 13 87
# description: Log.io Harvester.
# processname: log.io-harvester
# config: /etc/log.io/harvester.conf
# Source function library.
. /etc/rc.d/init.d/functions
LOGFILE="/var/log/log.io/harvester.log"
PROG="/usr/local/bin/log.io-harvester"
start(){
echo -n "Starting $PROG:"
nohup $PROG >$LOGFILE 2>&1 &
RUNNING=`ps ax | grep -v grep | grep -c $PROG`
if [ $RUNNING -gt 0 ]; then
echo_success
else
echo_failure
fi
echo
}
stop(){
PID=`ps x | grep -v grep | grep $PROG | awk '{print $1}'`;
echo -n "Stopping $PROG:"
if [ "x$PID" != "x" ]; then
kill $PID;
fi
RUNNING=`ps ax | grep -v grep | grep -c $PROG`
if [ $RUNNING -gt 0 ]; then
echo_failure
else
echo_success
fi
echo
}
restart(){
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac