init.d: add try-restart, force reload
http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
Elan Ruusamäe committed
May 23, 2016 at 08:49 UTC
693ce95ff61aaa8c399c7c9e27ff5d3cd50e8a62
1 file changed
+30
-7
system/netdata-init-d.in
+30
-7
@@ -1,6 +1,12 @@
1
-#!/bin/bash
1
+#!/bin/sh
2
+#
3
+# netdata Real-time charts for system monitoring
4
# chkconfig: 345 99 01
3
-# description: startup script
5
+# description: Netdata is a daemon that collects data in realtime (per second)
6
+# and presents a web site to view and analyze them. The presentation
7
+# is also real-time and full of interactive charts that precisely
8
+# render all collected values.
9
+# processname: netdata
10
11
# Source functions
12
. /etc/rc.d/init.d/functions
@@ -32,6 +38,17 @@ service_stop()
38
return $RETVAL
39
}
40
41
+condrestart()
42
+{
43
+ if ! service_status > /dev/null; then
44
+ RETVAL=$1
45
+ return
46
+ fi
47
+
48
+ service_stop
49
+ service_start
50
+}
51
+
52
service_status()
53
{
54
status -p ${PIDFILE} $DAEMON_PATH/$DAEMON
@@ -41,9 +58,6 @@ case "$1" in
58
start)
59
service_start
60
;;
44
-status)
45
- service_status
46
-;;
61
stop)
62
service_stop
63
;;
@@ -51,7 +65,16 @@ restart)
65
service_stop
66
service_start
67
;;
68
+try-restart)
69
+ condrestart 0
70
+ ;;
71
+force-reload)
72
+ condrestart 7
73
+;;
74
+status)
75
+ service_status
76
+;;
77
*)
55
- echo "Usage: $0 {status|start|stop|restart}"
56
- exit 1
78
+ echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
79
+ exit 3
80
esac