diff options
author | Paul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com> | 2019-10-06 12:27:53 +0200 |
---|---|---|
committer | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2019-10-06 12:27:53 +0200 |
commit | 65f4fe4fde1b469841e2f061b2d8a46af27eb94b (patch) | |
tree | 694fcbc0dce8df58fd3f1a86f041177a7ec20664 | |
parent | 88f27952f190a42779dad3eb5d4de4c22d4b71a3 (diff) |
netdata/installer: allow netdata service install, when docker runs systemd (#6987)
-rwxr-xr-x | netdata-installer.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index 14635f3321..4c3aeee71d 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -881,7 +881,20 @@ progress "Install netdata at system init" NETDATA_START_CMD="${NETDATA_PREFIX}/usr/sbin/netdata" if grep -q docker /proc/1/cgroup >/dev/null 2>&1; then - echo >&2 "We are running within a docker container, will not be installing netdata service" + # If docker runs systemd for some weird reason, let the install proceed + is_systemd_running="NO" + if command -v pidof >/dev/null 2>&1; then + is_systemd_running="$(pidof /usr/sbin/init || pidof systemd || echo "NO")" + else + is_systemd_running="$( (ps -p 1 | grep -q systemd && echo "1") || echo "NO")" + fi + + if [ "${is_systemd_running}" == "1" ]; then + echo >&2 "Found systemd within the docker container, running install_netdata_service() method" + install_netdata_service || run_failed "Cannot install netdata init service." + else + echo >&2 "We are running within a docker container, will not be installing netdata service" + fi echo >&2 else install_netdata_service || run_failed "Cannot install netdata init service." |