summaryrefslogtreecommitdiffstats
path: root/system/openrc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:04 +0000
commita836a244a3d2bdd4da1ee2641e3e957850668cea (patch)
treecb87c75b3677fab7144f868435243f864048a1e6 /system/openrc
parentAdding upstream version 1.38.1. (diff)
downloadnetdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.tar.xz
netdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.zip
Adding upstream version 1.39.0.upstream/1.39.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--system/openrc/conf.d/netdata.in24
-rw-r--r--system/openrc/init.d/netdata.in (renamed from system/netdata-openrc.in)38
2 files changed, 39 insertions, 23 deletions
diff --git a/system/openrc/conf.d/netdata.in b/system/openrc/conf.d/netdata.in
new file mode 100644
index 000000000..92f882608
--- /dev/null
+++ b/system/openrc/conf.d/netdata.in
@@ -0,0 +1,24 @@
+# The user netdata is configured to run as.
+# If you edit its configuration file to set a different user, set it
+# here too, to have its files switch ownership
+NETDATA_OWNER="@netdata_user_POST@:@netdata_user_POST@"
+
+# How long to wait for the agent to save it's database during shutdown.
+NETDATA_WAIT_EXIT_TIMEOUT=60
+
+# If set to 1, force an exit if we time out waiting for the agent to
+# save it's database during shutdown.
+NETDATA_FORCE_EXIT=0
+
+# If set to 1, use netdatacli when sending commands to the agent.
+# This should not be needed in most cases, but it can sometimes help
+# work around issues.
+#NETDATA_USE_NETDATACLI=1
+
+# Specify the path to the pidfile to be used when running in the
+# background.
+NETDATA_PIDFILE="@localstatedir_POST@/run/netdata/netdata.pid"
+
+# Uncomment the below line to run Netdata under OpenRC's native process
+# supervision.
+#supervisor="supervise-daemon"
diff --git a/system/netdata-openrc.in b/system/openrc/init.d/netdata.in
index 158878929..74242b3cb 100644
--- a/system/netdata-openrc.in
+++ b/system/openrc/init.d/netdata.in
@@ -1,37 +1,21 @@
#!/sbin/openrc-run
# SPDX-License-Identifier: GPL-3.0-or-later
-# The user netdata is configured to run as.
-# If you edit its configuration file to set a different
-# user, set it here too, to have its files switch ownership
-: "${NETDATA_OWNER:=@netdata_user_POST@:@netdata_user_POST@}"
+NETDATA_OWNER="@netdata_user_POST@:@netdata_user_POST@"
+NETDATA_PIDFILE="@localstatedir_POST@/run/netdata/netdata.pid"
-# The timeout in seconds to wait for netdata
-# to save its database on disk and exit.
-: "${NETDATA_WAIT_EXIT_TIMEOUT:=60}"
-
-# When set to 1, if netdata does not exit in
-# NETDATA_WAIT_EXIT_TIMEOUT, we will force it
-# to exit.
-: "${NETDATA_FORCE_EXIT:=0}"
-
-# When set to 1, we use netdatacli for reload/rotate/save commands instead of s-s-d.
-: "${NETDATA_USE_NETDATACLI:=0}"
-
-# Specifies the pidfile to use when running in the background.
-: "${NETDATA_PIDFILE:=@localstatedir_POST@/run/netdata/netdata.pid}"
+description="Run the Netdata system monitoring agent."
extra_started_commands="reload rotate save"
+description_reload="Reload health configuration."
+description_rotate="Reopen log files."
+description_save="Force sync of database to disk."
+
command_prefix="@sbindir_POST@"
command="${command_prefix}/netdata"
command_args="-P ${NETDATA_PIDFILE} ${NETDATA_EXTRA_ARGS}"
command_args_foreground="-D"
start_stop_daemon_args="-u ${NETDATA_OWNER}"
-if [ "${NETDATA_FORCE_EXIT}" -eq 1 ]; then
- retry="TERM/${NETDATA_WAIT_EXIT_TIMEOUT}/KILL/1"
-else
- retry="TERM/${NETDATA_WAIT_EXIT_TIMEOUT}"
-fi
depend() {
use logger
@@ -47,6 +31,14 @@ start_pre() {
fi
}
+stop_pre() {
+ if [ "0${NETDATA_FORCE_EXIT}" -eq 1 ]; then
+ retry="TERM/${NETDATA_WAIT_EXIT_TIMEOUT:-60}/KILL/1"
+ else
+ retry="TERM/${NETDATA_WAIT_EXIT_TIMEOUT:-60}"
+ fi
+}
+
run_cmd() {
cmd="${1}"
msg="${2}"