blob: edda9950f0488f707261686681d776d117f3db18 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh
#
# netdata Real-time performance monitoring, done right
# chkconfig: 345 99 01
# description: Netdata is a daemon that collects data in real-time (per second)
# and presents a web site to view and analyze them. The presentation
# is also real-time and full of interactive charts that precisely
# render all collected values.
# processname: netdata
# Source functions
. /etc/rc.d/init.d/functions
DAEMON="netdata"
DAEMON_PATH=@sbindir_POST@
PIDFILE=@localstatedir_POST@/run/$DAEMON.pid
DAEMONOPTS="-P $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
}
condrestart()
{
if ! service_status > /dev/null; then
RETVAL=$1
return $RETVAL
fi
service_stop
service_start
}
service_status()
{
status -p ${PIDFILE} $DAEMON_PATH/$DAEMON
}
case "$1" in
start)
service_start
;;
stop)
service_stop
;;
restart)
service_stop
service_start
;;
try-restart)
condrestart 0
;;
force-reload)
condrestart 7
;;
status)
service_status
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 3
esac
|