summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2020-09-28 07:07:18 -0400
committerGitHub <noreply@github.com>2020-09-28 07:07:18 -0400
commite35130bcf099a82afbeaac5b807ebee712b4125d (patch)
tree987573e207d913076a59595bc066a7d823c15bb4 /system
parentfff5000a270e63762d417547f91671bc1cd45cd9 (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 'system')
-rw-r--r--system/Makefile.am4
-rw-r--r--system/netdata-updater.service.in8
-rw-r--r--system/netdata-updater.timer12
3 files changed, 24 insertions, 0 deletions
diff --git a/system/Makefile.am b/system/Makefile.am
index 6b9e8f7f7e..5323738c95 100644
--- a/system/Makefile.am
+++ b/system/Makefile.am
@@ -13,6 +13,7 @@ CLEANFILES = \
netdata-freebsd \
netdata.plist \
netdata.crontab \
+ netdata-updater.service \
$(NULL)
include $(top_srcdir)/build/subst.inc
@@ -36,6 +37,7 @@ nodist_noinst_DATA = \
netdata-freebsd \
netdata.plist \
netdata.crontab \
+ netdata-updater.service \
$(NULL)
dist_noinst_DATA = \
@@ -50,4 +52,6 @@ dist_noinst_DATA = \
netdata.plist.in \
netdata.conf \
netdata.crontab.in \
+ netdata-updater.service.in \
+ netdata-updater.timer \
$(NULL)
diff --git a/system/netdata-updater.service.in b/system/netdata-updater.service.in
new file mode 100644
index 0000000000..d0bd4994c4
--- /dev/null
+++ b/system/netdata-updater.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=Daily auto-updates for Netdata
+RefuseManualStart=no
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+ExecStart=@pkglibexecdir_POST@/netdata-updater.sh
diff --git a/system/netdata-updater.timer b/system/netdata-updater.timer
new file mode 100644
index 0000000000..8b36e46ff4
--- /dev/null
+++ b/system/netdata-updater.timer
@@ -0,0 +1,12 @@
+[Unit]
+Description=Daily auto-updates for Netdata
+RefuseManualStart=no
+RefuseManualStop=no
+
+[Timer]
+Persistent=false
+OnCalendar=daily
+Unit=netdata-updater.service
+
+[Install]
+WantedBy=timers.target