diff options
author | Elan Ruusamäe <glen@delfi.ee> | 2016-05-23 08:49:24 +0300 |
---|---|---|
committer | Elan Ruusamäe <glen@delfi.ee> | 2016-05-23 08:49:26 +0300 |
commit | 693ce95ff61aaa8c399c7c9e27ff5d3cd50e8a62 (patch) | |
tree | d2680057ceffba9d5689d5c6df8798218390045b /system | |
parent | c27b7e531aad8115137c9845775745672b431a21 (diff) |
init.d: add try-restart, force reload
http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
Diffstat (limited to 'system')
-rwxr-xr-x | system/netdata-init-d.in | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/system/netdata-init-d.in b/system/netdata-init-d.in index c317d10211..3e82d0d366 100755 --- a/system/netdata-init-d.in +++ b/system/netdata-init-d.in @@ -1,6 +1,12 @@ -#!/bin/bash +#!/bin/sh +# +# netdata Real-time charts for system monitoring # chkconfig: 345 99 01 -# description: startup script +# description: Netdata is a daemon that collects data in realtime (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 @@ -32,6 +38,17 @@ service_stop() return $RETVAL } +condrestart() +{ + if ! service_status > /dev/null; then + RETVAL=$1 + return + 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 |