summaryrefslogtreecommitdiffstats
path: root/contrib/sles11/netdata.init
blob: 3081c427c80ddfee5f0922cb0e96357ff18dccad (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
#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          netdata
# Required-Start:    $all
# Should-Start:      
# Required-Stop:     $all
# Should-Stop:       
# Default-Start:     2 3 5
# Default-Stop:
# Short-Description: Start and stop the netdata real-time monitoring server daemon
# Description:       Controls the main netdata monitoring server daemon "netdata".
### END INIT INFO

DAEMON="netdata"
DAEMON_BIN="/usr/sbin/${DAEMON}"
DAEMON_PID="/var/run/${DAEMON}.pid"
DAEMON_ARGS=""

. /etc/rc.status
rc_reset

if [ ! -x $DAEMON_BIN ]; then
    echo -n >&2 "${DAEMON} binary is not installed. "
    rc_status -s
    exit 5
fi

case "$1" in
  start)
    echo -n "Starting $DAEMON"
    /sbin/startproc $DAEMON_BIN $DAEMON_ARGS 
    rc_status -v 
    ;;

  stop)
    echo -n "Stopping $DAEMON"
    /sbin/killproc $DAEMON_BIN
    rc_status -v
    ;;

  reload)
    # netdata: HUP reopen log files, USR1 save DB, USR2 reload health config
    echo -n "Reloading $DAEMON config"
    /sbin/killproc -USR2 $DAEMON_BIN
    ;;

  restart)
    $0 stop
    $0 start
    ;;

  status)
    echo -n "Checking $DAEMON"
    /sbin/checkproc $DAEMON_BIN
    rc_status -v
    ;;

  *)
    echo "Usage: $0 {start|stop|status|reload|restart}"
    exit 1
    ;;

esac
rc_exit