]> arthur.barton.de Git - netdata.git/blob - system/netdata-init-d.in
As suggested, tweaked tomcat_url for better handling, added array for single xml...
[netdata.git] / system / netdata-init-d.in
1 #!/bin/bash
2 # chkconfig: 345 99 01
3 # description: startup script
4
5 # Source functions
6 . /etc/rc.d/init.d/functions
7
8 DAEMON="netdata"
9 DAEMON_PATH=@sbindir_POST@
10 PIDFILE=@localstatedir_POST@/$DAEMON.pid
11 DAEMONOPTS="-pidfile $PIDFILE"
12 STOP_TIMEOUT="10"
13
14 service_start()
15 {
16         printf "%-50s" "Starting $DAEMON..."
17         daemon $DAEMON_PATH/$DAEMON $DAEMONOPTS
18         echo
19 }
20
21 service_stop()
22 {
23         printf "%-50s" "Stopping $DAEMON..."
24         killproc -p ${PIDFILE} -d ${STOP_TIMEOUT} $DAEMON
25         rm -f ${PIDFILE}
26         echo
27 }
28
29 service_status()
30 {
31         status -p ${PIDFILE} $DAEMON_PATH/$DAEMON
32 }
33
34 case "$1" in
35 start)
36         service_start
37 ;;
38 status)
39         service_status
40 ;;
41 stop)
42         service_stop
43 ;;
44 restart)
45         service_stop
46         service_start
47 ;;
48 *)
49         echo "Usage: $0 {status|start|stop|restart}"
50         exit 1
51 esac