diff options
author | waldemar.spitschak <waldemar.spitschak@esailors.de> | 2016-04-05 19:43:45 +0200 |
---|---|---|
committer | waldemar.spitschak <waldemar.spitschak@esailors.de> | 2016-04-05 19:43:45 +0200 |
commit | 2a069332afa7f1eb507654e352f0ded53b7418da (patch) | |
tree | 1284c2fccb6518027183f43f5be8f54104720c88 /system | |
parent | 287892ae84c38d3403fc11c4bc0aeb5b18a14334 (diff) |
Added init script generation for Redhat6/Centos6
Diffstat (limited to 'system')
-rw-r--r-- | system/Makefile.am | 3 | ||||
-rwxr-xr-x | system/netdata-init-d.in | 51 |
2 files changed, 54 insertions, 0 deletions
diff --git a/system/Makefile.am b/system/Makefile.am index c917a2298e..49cb5f7bc1 100644 --- a/system/Makefile.am +++ b/system/Makefile.am @@ -5,6 +5,7 @@ MAINTAINERCLEANFILES= $(srcdir)/Makefile.in CLEANFILES = \ netdata-openrc \ netdata.service \ + netdata-init-d \ $(NULL) include $(top_srcdir)/build/subst.inc @@ -14,9 +15,11 @@ SUFFIXES = .in nodist_noinst_DATA = \ netdata-openrc \ netdata.service \ + netdata-init-d \ $(NULL) dist_noinst_DATA = \ netdata-openrc.in \ netdata.service.in \ + netdata-init-d.in \ $(NULL) diff --git a/system/netdata-init-d.in b/system/netdata-init-d.in new file mode 100755 index 0000000000..8c46433693 --- /dev/null +++ b/system/netdata-init-d.in @@ -0,0 +1,51 @@ +#!/bin/bash +# chkconfig: 345 99 01 +# description: startup script + +# Source functions +. /etc/rc.d/init.d/functions + +DAEMON="netdata" +DAEMON_PATH=@sbindir_POST@ +PIDFILE=@localstatedir_POST@/$DAEMON.pid +DAEMONOPTS="-pidfile $PIDFILE" +STOP_TIMEOUT="10" + +service_start() +{ + printf "%-50s" "Starting $DAEMON..." + daemon $DAEMON_PATH/$DAEMON $DAEMONOPTS + echo +} + +service_stop() +{ + printf "%-50s" "Stopping $DAEMON..." + killproc -p ${PIDFILE} -d ${STOP_TIMEOUT} $DAEMON + rm -f ${PIDFILE} + echo +} + +service_status() +{ + status -p ${PIDFILE} $DAEMON_PATH/$DAEMON +} + +case "$1" in +start) + service_start +;; +status) + service_status +;; +stop) + service_stop +;; +restart) + service_stop + service_start +;; +*) + echo "Usage: $0 {status|start|stop|restart}" + exit 1 +esac |