diff options
author | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2019-03-24 13:37:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-24 13:37:25 +0100 |
commit | 84c1fe678f72e86ac18d6dd4d68008198f8f0413 (patch) | |
tree | 604dfc8fd79ee0cda40a0a3f3b79f94b104069ad /packaging/installer/netdata-updater.sh | |
parent | 71e4d0a764124bd80c936d1683688cc97c11dc58 (diff) |
Remove temp log file if no update needed (#5695)
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rw-r--r-- | packaging/installer/netdata-updater.sh | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 2dce5efc1e..071198dd6c 100644 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -77,36 +77,35 @@ update() { download "${NETDATA_TARBALL_CHECKSUM_URL}" "${dir}/sha256sum.txt" >&3 2>&3 if grep "${NETDATA_TARBALL_CHECKSUM}" sha256sum.txt >&3 2>&3; then info "Newest version is already installed" - exit 0 - fi - - download "${NETDATA_TARBALL_URL}" "${dir}/netdata-latest.tar.gz" - if ! grep netdata-latest.tar.gz sha256sum.txt | sha256sum --check - >&3 2>&3; then - failed "Tarball checksum validation failed. Stopping netdata upgrade and leaving tarball in ${dir}" - fi - NEW_CHECKSUM="$(sha256sum netdata-latest.tar.gz 2>/dev/null| cut -d' ' -f1)" - tar -xf netdata-latest.tar.gz >&3 2>&3 - rm netdata-latest.tar.gz >&3 2>&3 - cd netdata-* - - # signal netdata to start saving its database - # this is handy if your database is big - pids=$(pidof netdata) - do_not_start= - if [ -n "${pids}" ]; then - #shellcheck disable=SC2086 - kill -USR1 ${pids} else - # netdata is currently not running, so do not start it after updating - do_not_start="--dont-start-it" - fi - - info "Re-installing netdata..." - eval "${REINSTALL_COMMAND} --dont-wait ${do_not_start}" >&3 2>&3 || fatal "FAILED TO COMPILE/INSTALL NETDATA" - sed -i '/NETDATA_TARBALL/d' "${ENVIRONMENT_FILE}" - cat <<EOF >>"${ENVIRONMENT_FILE}" + download "${NETDATA_TARBALL_URL}" "${dir}/netdata-latest.tar.gz" + if ! grep netdata-latest.tar.gz sha256sum.txt | sha256sum --check - >&3 2>&3; then + failed "Tarball checksum validation failed. Stopping netdata upgrade and leaving tarball in ${dir}" + fi + NEW_CHECKSUM="$(sha256sum netdata-latest.tar.gz 2>/dev/null| cut -d' ' -f1)" + tar -xf netdata-latest.tar.gz >&3 2>&3 + rm netdata-latest.tar.gz >&3 2>&3 + cd netdata-* + + # signal netdata to start saving its database + # this is handy if your database is big + pids=$(pidof netdata) + do_not_start= + if [ -n "${pids}" ]; then + #shellcheck disable=SC2086 + kill -USR1 ${pids} + else + # netdata is currently not running, so do not start it after updating + do_not_start="--dont-start-it" + fi + + info "Re-installing netdata..." + eval "${REINSTALL_COMMAND} --dont-wait ${do_not_start}" >&3 2>&3 || fatal "FAILED TO COMPILE/INSTALL NETDATA" + sed -i '/NETDATA_TARBALL/d' "${ENVIRONMENT_FILE}" + cat <<EOF >>"${ENVIRONMENT_FILE}" NETDATA_TARBALL_CHECKSUM="$NEW_CHECKSUM" EOF + fi rm -rf "${dir}" >&3 2>&3 [ -n "${logfile}" ] && rm "${logfile}" && logfile= |