diff options
author | Lennart Weller <lhw@ring0.de> | 2016-09-05 08:27:21 +0000 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2016-09-05 08:27:21 +0000 |
commit | 1746898cefcb17f58b5cf27b4dad3d28236f1152 (patch) | |
tree | 9207f191cf39bbd077a1e1c73d6e82123e2fc710 /system/netdata-init-d.in | |
parent | Imported Upstream version 1.2.0+dfsg (diff) | |
download | netdata-1746898cefcb17f58b5cf27b4dad3d28236f1152.tar.xz netdata-1746898cefcb17f58b5cf27b4dad3d28236f1152.zip |
Imported Upstream version 1.3.0+dfsgupstream/1.3.0+dfsg
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x] | system/netdata-init-d.in | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/system/netdata-init-d.in b/system/netdata-init-d.in index c317d1021..edda9950f 100755..100644 --- a/system/netdata-init-d.in +++ b/system/netdata-init-d.in @@ -1,14 +1,20 @@ -#!/bin/bash +#!/bin/sh +# +# netdata Real-time performance monitoring, done right # chkconfig: 345 99 01 -# description: startup script +# 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@/$DAEMON.pid -DAEMONOPTS="-pidfile $PIDFILE" +PIDFILE=@localstatedir_POST@/run/$DAEMON.pid +DAEMONOPTS="-P $PIDFILE" STOP_TIMEOUT="10" service_start() @@ -32,6 +38,17 @@ service_stop() 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 @@ -41,9 +58,6 @@ case "$1" in start) service_start ;; -status) - service_status -;; stop) service_stop ;; @@ -51,7 +65,16 @@ restart) service_stop service_start ;; +try-restart) + condrestart 0 + ;; +force-reload) + condrestart 7 +;; +status) + service_status +;; *) - echo "Usage: $0 {status|start|stop|restart}" - exit 1 + echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 esac |