]> git.pld-linux.org Git - packages/mlocate.git/commitdiff
- cronjobs support added
authorMateusz Korniak <matkor@pld-linux.org>
Tue, 4 Apr 2017 09:41:33 +0000 (11:41 +0200)
committerMateusz Korniak <matkor@pld-linux.org>
Tue, 4 Apr 2017 09:41:33 +0000 (11:41 +0200)
cronjob-mlocate.service [new file with mode: 0644]
cronjob-mlocate.timer [new file with mode: 0644]
mlocate.spec

diff --git a/cronjob-mlocate.service b/cronjob-mlocate.service
new file mode 100644 (file)
index 0000000..595d67f
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=mlocate cronjob
+
+[Service]
+ExecStart=/usr/bin/updatedb
+Type=simple
+Nice=19
+IOSchedulingClass=2
+IOSchedulingPriority=7
+
+
diff --git a/cronjob-mlocate.timer b/cronjob-mlocate.timer
new file mode 100644 (file)
index 0000000..2b6ecc5
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=mlocate cronjob timer
+
+[Timer]
+OnCalendar=*-*-* 03:49:00
+Persistent=True
+
+[Install]
+WantedBy=cronjobs.target
+
+# vi: ft=systemd
index bf392eef872284744b123d4cf42a5cc8bd598ed8..1992c64fa06f7ed225ea6b01d5c68e4f6bb8667a 100644 (file)
@@ -1,14 +1,22 @@
+# TODO: 
+# - Add 
+#      nodevs=$(awk '$1 == "nodev" && $2 != "rootfs" { print $2 }' /proc/filesystems)
+#      exec /usr/bin/updatedb -f "$nodevs"
+#   to ExecStart=/usr/bin/updatedb
+
 Summary:       A locate/updatedb implementation
 Summary(pl.UTF-8):     Implementacja locate/updatedb
 Name:          mlocate
 Version:       0.26
-Release:       4
+Release:       5
 License:       GPL v2
 Group:         Applications/System
 Source0:       https://fedorahosted.org/releases/m/l/mlocate/%{name}-%{version}.tar.xz
 # Source0-md5: 539e6f86bf387358aa2b14d5f880e49a
 Source1:       updatedb.conf
 Source2:       %{name}.cron
+Source3:       cronjob-%{name}.timer
+Source4:       cronjob-%{name}.service
 URL:           https://fedorahosted.org/mlocate/
 BuildRequires: rpmbuild(macros) >= 1.228
 BuildRequires: tar >= 1:1.22
@@ -17,7 +25,9 @@ Requires(postun):     /usr/sbin/groupdel
 Requires(pre): /usr/bin/getgid
 Requires(pre): /usr/sbin/groupadd
 Requires:      awk
-Requires:      crondaemon
+Requires:      rc-scripts >= 0.4.2.4-2
+Requires:      systemd-units >= 38
+Suggests:      cronjobs
 Provides:      group(mlocate)
 Provides:      locate-utility
 Obsoletes:     locate-utility
@@ -59,6 +69,11 @@ cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/updatedb.conf
 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.daily/%{name}.cron
 touch $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/%{name}.db
 
+install -d  $RPM_BUILD_ROOT%{systemdunitdir}
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
+install -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
+
+
 %find_lang %{name}
 
 %clean
@@ -71,11 +86,18 @@ rm -rf $RPM_BUILD_ROOT
 if [ ! -f %{_localstatedir}/lib/%{name}/%{name}.db ]; then
        echo 'Run "%{_bindir}/updatedb" if you want to make %{name} database immediately.'
 fi
+%systemd_post cronjob-%{name}.timer
+
+%preun
+%systemd_preun cronjob-%{name}.timer
+
 
 %postun
 if [ "$1" = "0" ]; then
        %groupremove %{name}
 fi
+%systemd_reload
+
 
 %files -f %{name}.lang
 %defattr(644,root,root,755)
@@ -90,3 +112,6 @@ fi
 %{_mandir}/man8/updatedb.8*
 %dir %attr(750,root,mlocate) /var/lib/%{name}
 %ghost %{_localstatedir}/lib/%{name}/%{name}.db
+%{systemdunitdir}/cronjob-%{name}.service
+%{systemdunitdir}/cronjob-%{name}.timer
+
This page took 0.076671 seconds and 4 git commands to generate.