diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-01-20 17:43:05 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-01-20 17:43:05 +0200 |
commit | 67d4998cca7ee3015ba90f0e2c1d35fd05d92f9c (patch) | |
tree | ac9993b4a38824d0bb0087ce33693255651126ed /installer | |
parent | 1781ff1736dd531cf0ef26c45c24b2c247af2e29 (diff) |
check if netdata is really started; fixes #3321
Diffstat (limited to 'installer')
-rw-r--r-- | installer/functions.sh | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/installer/functions.sh b/installer/functions.sh index 8c3af89e94..2eeb92c8fc 100644 --- a/installer/functions.sh +++ b/installer/functions.sh @@ -592,7 +592,7 @@ stop_netdata_on_pid() { return 0 } -stop_all_netdata() { +netdata_pids() { local p myns ns myns="$(readlink /proc/self/ns/pid 2>/dev/null)" @@ -608,11 +608,19 @@ stop_all_netdata() { if [ -z "${myns}" -o -z "${ns}" -o "${myns}" = "${ns}" ] then - stop_netdata_on_pid ${p} + pidisnetdata ${p} && echo "${p}" fi done } +stop_all_netdata() { + local p + for p in $(netdata_pids) + do + stop_netdata_on_pid ${p} + done +} + # ----------------------------------------------------------------------------- # restart netdata @@ -630,12 +638,24 @@ restart_netdata() { stop_all_netdata service netdata restart && started=1 + if [ ${started} -eq 1 -a -z "$(netdata_pids)" ] + then + echo >&2 "Ooops! it seems netdata is not started." + started=0 + fi + if [ ${started} -eq 0 ] then service netdata start && started=1 fi fi + if [ ${started} -eq 1 -a -z "$(netdata_pids)" ] + then + echo >&2 "Hm... it seems netdata is still not started." + started=0 + fi + if [ ${started} -eq 0 ] then # still not started... |