netdata/installer: allow netdata service install, when docker runs systemd (#6987)
Paul Emm. Katsoulakis committed
Oct 6, 2019 at 12:27 UTC
65f4fe4fde1b469841e2f061b2d8a46af27eb94b
1 file changed
+14
-1
netdata-installer.sh
+14
-1
@@ -881,7 +881,20 @@ progress "Install netdata at system init"
881
NETDATA_START_CMD="${NETDATA_PREFIX}/usr/sbin/netdata"
882
883
if grep -q docker /proc/1/cgroup >/dev/null 2>&1; then
884
- echo >&2 "We are running within a docker container, will not be installing netdata service"
884
+ # If docker runs systemd for some weird reason, let the install proceed
885
+ is_systemd_running="NO"
886
+ if command -v pidof >/dev/null 2>&1; then
887
+ is_systemd_running="$(pidof /usr/sbin/init || pidof systemd || echo "NO")"
888
+ else
889
+ is_systemd_running="$( (ps -p 1 | grep -q systemd && echo "1") || echo "NO")"
890
+ fi
891
+
892
+ if [ "${is_systemd_running}" == "1" ]; then
893
+ echo >&2 "Found systemd within the docker container, running install_netdata_service() method"
894
+ install_netdata_service || run_failed "Cannot install netdata init service."
895
+ else
896
+ echo >&2 "We are running within a docker container, will not be installing netdata service"
897
+ fi
898
echo >&2
899
else
900
install_netdata_service || run_failed "Cannot install netdata init service."