diff --git a/geoipupdate.changes b/geoipupdate.changes index 9eca246..63c554e 100644 --- a/geoipupdate.changes +++ b/geoipupdate.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jun 20 05:35:01 UTC 2019 - Wolfgang Rosenauer + +- added systemd timer for weekly updates + (needs to be enabled by admin) + ------------------------------------------------------------------- Wed Jun 19 10:34:53 UTC 2019 - Johannes Weberhofer diff --git a/geoipupdate.service b/geoipupdate.service new file mode 100644 index 0000000..894e8f4 --- /dev/null +++ b/geoipupdate.service @@ -0,0 +1,9 @@ +[Unit] +Description=Update GeoIP databases +Documentation=man:geoipupdate(1) man:GeoIP.conf(5) + +[Service] +Type=oneshot +WorkingDirectory=/var/lib/GeoIP + +ExecStart=/usr/bin/geoipupdate diff --git a/geoipupdate.spec b/geoipupdate.spec index 3bd0844..69dccce 100644 --- a/geoipupdate.spec +++ b/geoipupdate.spec @@ -24,12 +24,16 @@ License: GPL-2.0-only Group: Productivity/Networking/System URL: https://www.maxmind.com Source0: https://github.com/maxmind/geoipupdate-legacy/archive/v%{version}/%{name}-legacy-%{version}.tar.gz +Source1: geoipupdate.timer +Source2: geoipupdate.service BuildRequires: autoconf BuildRequires: libtool BuildRequires: pkgconfig BuildRequires: pkgconfig(libcurl) +BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(zlib) Conflicts: GeoIP < 1.6.0 +%{?systemd_requires} %description The GeoIP Update program performs automatic updates of GeoIP2 and GeoIP @@ -51,10 +55,24 @@ install -d %{buildroot}%{_localstatedir}/lib/GeoIP install -D -p -m 0644 conf/GeoIP.conf.default \ %{buildroot}%{_sysconfdir}/GeoIP.conf.default rm -rf %{buildroot}%{_datadir}/doc/geoipupdate +install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.timer +install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service %check make %{?_smp_mflags} check +%pre +%service_add_pre %{name}.service + +%post +%service_add_post %{name}.service + +%preun +%service_del_preun %{name}.service + +%postun +%service_del_postun %{name}.service + %files %license LICENSE %doc README.md ChangeLog.md @@ -62,6 +80,8 @@ make %{?_smp_mflags} check %config %{_sysconfdir}/GeoIP.conf.default %dir %{_localstatedir}/lib/GeoIP %{_bindir}/geoipupdate +%{_unitdir}/%{name}.service +%{_unitdir}/%{name}.timer %{_mandir}/man1/geoipupdate.1%{?ext_man} %{_mandir}/man5/GeoIP.conf.5%{?ext_man} diff --git a/geoipupdate.timer b/geoipupdate.timer new file mode 100644 index 0000000..42dd542 --- /dev/null +++ b/geoipupdate.timer @@ -0,0 +1,12 @@ +[Unit] +Description=Weekly update of GeoLite2 databases +Documentation=man:geoipupdate(1) man:GeoIP.conf(5) + +[Timer] +OnUnitInactiveSec=1w +OnStartupSec=1h +AccuracySec=1h + +[Install] +WantedBy=timers.target +