[updater] only restart when previously running
Updating netdata (e.g. headless via cron) should not start netdata in case it was not running before.
Jakob Ackermann committed
Feb 28, 2018 at 01:23 UTC
33f9ae7f193771c925e42d5ff8904051f44d2e6e
1 file changed
+9
-2
netdata-installer.sh
+9
-2
@@ -1234,7 +1234,14 @@ cd "${REINSTALL_PWD}" || exit 1
1234
# signal netdata to start saving its database
1235
# this is handy if your database is big
1236
pids=\$(pidof netdata)
1237
-[ ! -z "\${pids}" ] && kill -USR1 \${pids}
1237
+do_not_start=
1238
+if [ ! -z "\${pids}" ]
1239
+ then
1240
+ kill -USR1 \${pids}
1241
+else
1242
+ # netdata is currently not running, so do not start it after updating
1243
+ do_not_start="--dont-start-it"
1244
+fi
1245
1246
tmp=
1247
if [ -t 2 ]
@@ -1305,7 +1312,7 @@ update() {
1312
1313
emptyline
1314
info "Re-installing netdata..."
1308
- ${REINSTALL_COMMAND} --dont-wait >&3 2>&3 || failed "FAILED TO COMPILE/INSTALL NETDATA"
1315
+ ${REINSTALL_COMMAND} --dont-wait \${do_not_start} >&3 2>&3 || failed "FAILED TO COMPILE/INSTALL NETDATA"
1316
1317
[ ! -z "\${tmp}" ] && rm "\${tmp}" && tmp=
1318
return 0