X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=system%2Fnetdata-init-d.in;h=edda9950f0488f707261686681d776d117f3db18;hb=81b986a426cf51002a2073085e83a9a83bf957be;hp=c317d10211679e46243771e357b1803076b432da;hpb=4728f89e2d0c42f9ad4da1e3075a0321553e9937;p=netdata.git diff --git a/system/netdata-init-d.in b/system/netdata-init-d.in old mode 100755 new mode 100644 index c317d102..edda9950 --- 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