diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2020-09-28 07:07:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 07:07:18 -0400 |
commit | e35130bcf099a82afbeaac5b807ebee712b4125d (patch) | |
tree | 987573e207d913076a59595bc066a7d823c15bb4 /netdata-installer.sh | |
parent | fff5000a270e63762d417547f91671bc1cd45cd9 (diff) |
Added improved auto-update support. (#9966)
* Add systemd timer unit to handle auto updates.
This adds a systemd timer unit and associated service for running the
updaterscript. This allows better support for auto-updates on systems
that use systemd, removing the need for cron or special shims to handle
periodic tasks.
This will be used in preference to our existing auto-update support on
systems running systemd unless the user overrides this behavior.
* Add an option to the installer to override auto-updater type detection.
This allows users to specify what auto-updater scheduling mechanism to
use. This wil persist the selection to updates as well.
Supported values are:
* systemd': Uses a systemd timer unit and service to handle automatic
updates.
* 'interval': Uses a script in /etc/cron.daily or /etc/periodic/daily.
* `crontab`: Uses a crontab file in /etc/cron.d.
* Change priority of systemd support.
This way existing users won't get converted, and by default you'll still
get emails on failures.
* Case-normalize the value passed to --auto-update-type.
* Fix incorrect naming of crontab file.
* Fixed function naming.
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-x | netdata-installer.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index 5580d46bc2..b83bd3b791 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -205,6 +205,8 @@ USAGE: ${PROGRAM} [options] --dont-start-it Do not (re)start netdata after installation --dont-wait Run installation in non-interactive mode --auto-update or -u Install netdata-updater in cron to update netdata automatically once per day + --auto-update-type Override the auto-update scheduling mechanism detection, currently supported types + are: systemd, interval, crontab --stable-channel Use packages from GitHub release pages instead of GCS (nightly updates). This results in less frequent updates. --nightly-channel Use most recent nightly udpates instead of GitHub releases. @@ -277,6 +279,18 @@ while [ -n "${1}" ]; do "--dont-start-it") DONOTSTART=1 ;; "--dont-wait") DONOTWAIT=1 ;; "--auto-update" | "-u") AUTOUPDATE=1 ;; + "--auto-update-type") + AUTO_UPDATE_TYPE="$(echo "${2}" | tr '[:upper:]' '[:lower:]')" + case "${AUTO_UPDATE_TYPE}" in + systemd|interval|crontab) + shift 1 + ;; + *) + echo "Unrecognized value for --auto-update-type. Valid values are: systemd, interval, crontab" + exit 1 + ;; + esac + ;; "--stable-channel") RELEASE_CHANNEL="stable" ;; "--nightly-channel") RELEASE_CHANNEL="nightly" ;; "--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-plugin-freeipmi/} --enable-plugin-freeipmi" ;; @@ -1796,7 +1810,7 @@ install_netdata_updater || run_failed "Cannot install netdata updater tool." progress "Check if we must enable/disable the netdata updater tool" if [ "${AUTOUPDATE}" = "1" ]; then - enable_netdata_updater || run_failed "Cannot enable netdata updater tool" + enable_netdata_updater ${AUTO_UPDATE_TYPE} || run_failed "Cannot enable netdata updater tool" else disable_netdata_updater || run_failed "Cannot disable netdata updater tool" fi |