Added init script generation for Redhat6/Centos6
waldemar.spitschak committed
Apr 5, 2016 at 19:43 UTC
2a069332afa7f1eb507654e352f0ded53b7418da
2 files changed
+54
system/Makefile.am
+3
@@ -5,6 +5,7 @@ MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
5
CLEANFILES = \
6
netdata-openrc \
7
netdata.service \
8
+ netdata-init-d \
9
$(NULL)
10
11
include $(top_srcdir)/build/subst.inc
@@ -14,9 +15,11 @@ SUFFIXES = .in
15
nodist_noinst_DATA = \
16
netdata-openrc \
17
netdata.service \
18
+ netdata-init-d \
19
$(NULL)
20
21
dist_noinst_DATA = \
22
netdata-openrc.in \
23
netdata.service.in \
24
+ netdata-init-d.in \
25
$(NULL)
system/netdata-init-d.in
new
+51
@@ -0,0 +1,51 @@
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