blob: c317d10211679e46243771e357b1803076b432da (
plain)
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/bash
# chkconfig: 345 99 01
# description: startup script
# Source functions
. /etc/rc.d/init.d/functions
DAEMON="netdata"
DAEMON_PATH=@sbindir_POST@
PIDFILE=@localstatedir_POST@/$DAEMON.pid
DAEMONOPTS="-pidfile $PIDFILE"
STOP_TIMEOUT="10"
service_start()
{
echo "Starting $DAEMON..."
daemon $DAEMON_PATH/$DAEMON $DAEMONOPTS
RETVAL=$?
echo
return $RETVAL
}
service_stop()
{
printf "%-50s" "Stopping $DAEMON..."
killproc -p ${PIDFILE} -d ${STOP_TIMEOUT} $DAEMON
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
rm -f ${PIDFILE}
fi
echo
return $RETVAL
}
service_status()
{
status -p ${PIDFILE} $DAEMON_PATH/$DAEMON
}
case "$1" in
start)
service_start
;;
status)
service_status
;;
stop)
service_stop
;;
restart)
service_stop
service_start
;;
*)
echo "Usage: $0 {status|start|stop|restart}"
exit 1
esac
|