kevin pushed to spamassassin (master). "Switch to systemd timer unit from cron for rules updates. Fixes bug #1064537"
notifications at fedoraproject.org
notifications at fedoraproject.org
Fri Apr 3 17:34:26 UTC 2015
>From 569fc65779ae06da957e61de866bcdec60a4c9e1 Mon Sep 17 00:00:00 2001
From: Kevin Fenzi <kevin at scrye.com>
Date: Fri, 3 Apr 2015 11:34:14 -0600
Subject: Switch to systemd timer unit from cron for rules updates. Fixes bug
#1064537
diff --git a/sa-update.service b/sa-update.service
new file mode 100644
index 0000000..b8098e6
--- /dev/null
+++ b/sa-update.service
@@ -0,0 +1,28 @@
+### Spamassassin Rules Updates ###
+#
+# http://wiki.apache.org/spamassassin/RuleUpdates
+#
+# sa-update automatically updates your rules once per day if a spam daemon like
+# spamd or amavisd are running.
+
+[Unit]
+Description=Spamassassin Rules Update
+Documentation=man:sa-update(1)
+
+[Service]
+# Note that the opposite of "yes" is the empty string, NOT "no"
+# Options for the actual sa-update command
+# These are added to the channel configuration from
+# /etc/mail/spamassassin/channel.d/*.conf
+Environment=OPTIONS=-v
+
+# Debug script - send mail even if no update available
+#Environment=DEBUG=yes
+
+# Send mail when updates successfully processed
+# Default: send mail only on error
+#Environment=NOTIFY_UPD=yes
+
+ExecStart=/usr/share/spamassassin/sa-update.cron
+
+SuccessExitStatus=1
diff --git a/sa-update.timer b/sa-update.timer
new file mode 100644
index 0000000..6e5cba0
--- /dev/null
+++ b/sa-update.timer
@@ -0,0 +1,16 @@
+### Spamassassin Rules Updates ###
+#
+# http://wiki.apache.org/spamassassin/RuleUpdates
+#
+# sa-update automatically updates your rules once per day if a spam daemon like
+# spamd or amavisd are running.
+
+[Unit]
+Description=Spamassassin Rules Update timer
+Documentation=man:sa-update(1)
+
+[Timer]
+OnCalendar=daily
+
+[Install]
+WantedBy=spamassassin.service
diff --git a/spamassassin.service b/spamassassin.service
index 089c4cd..530f8f8 100644
--- a/spamassassin.service
+++ b/spamassassin.service
@@ -1,6 +1,7 @@
[Unit]
Description=Spamassassin daemon
After=syslog.target network.target
+Wants=sa-update.timer
[Service]
EnvironmentFile=-/etc/sysconfig/spamassassin
diff --git a/spamassassin.spec b/spamassassin.spec
index 66603ee..393ddb6 100644
--- a/spamassassin.spec
+++ b/spamassassin.spec
@@ -63,7 +63,7 @@ Summary: Spam filter for email which can be invoked from mail delivery agents
Name: spamassassin
Version: 3.4.0
#Release: 0.8.%{prerev}%{?dist}
-Release: 13%{?dist}
+Release: 14%{?dist}
License: ASL 2.0
Group: Applications/Internet
URL: http://spamassassin.apache.org/
@@ -87,6 +87,8 @@ Source13: README.RHEL.Fedora
Source14: spamassassin.service
%endif
Source15: spamassassin.sysconfig.el
+Source16: sa-update.service
+Source17: sa-update.timer
# Patches 0-99 are RH specific
# https://bugzilla.redhat.com/show_bug.cgi?id=1055593
@@ -207,7 +209,6 @@ install -m 0755 spamd/redhat-rc-script.sh %buildroot/%{_initrddir}/spamassassin
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/mail/spamassassin
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.d
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/mail/spamassassin/local.cf
%if %{use_systemd}
install -m644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/spamassassin
@@ -221,13 +222,19 @@ install -m 0644 %{SOURCE4} %buildroot/etc/mail/spamassassin
install -m 0755 %{SOURCE10} %buildroot/etc/mail/spamassassin
install -m 0644 %{SOURCE6} %buildroot/etc/logrotate.d/sa-update
+
+%if %{use_systemd} == 0
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.d
install -m 0644 %{SOURCE7} %buildroot/etc/cron.d/sa-update
+%endif
install -m 0644 %{SOURCE9} %buildroot%{_sysconfdir}/sysconfig/sa-update
# installed mode 744 as non root users can't run it, but can read it.
install -m 0744 %{SOURCE8} %buildroot%{_datadir}/spamassassin/sa-update.cron
%if %{use_systemd}
mkdir -p %buildroot%{_unitdir}
install -m 0644 %{SOURCE14} %buildroot%{_unitdir}/spamassassin.service
+install -m 0644 %{SOURCE16} %buildroot%{_unitdir}/sa-update.service
+install -m 0644 %{SOURCE17} %buildroot%{_unitdir}/sa-update.timer
%endif
[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
@@ -272,18 +279,20 @@ install -m 0644 %{SOURCE13} $RPM_BUILD_DIR/Mail-SpamAssassin-%{version}/
%doc README.RHEL.Fedora
%if %{use_systemd} == 0
%{_initrddir}/spamassassin
+%{_sysconfdir}/cron.d/sa-update
%endif
%dir %{_sysconfdir}/mail
%config(noreplace) %{_sysconfdir}/mail/spamassassin
%config(noreplace) %{_sysconfdir}/sysconfig/spamassassin
%config(noreplace) %{_sysconfdir}/sysconfig/sa-update
-%{_sysconfdir}/cron.d/sa-update
%dir %{_datadir}/spamassassin
%dir %{_localstatedir}/run/spamassassin
%dir %{_localstatedir}/lib/spamassassin
%config(noreplace) %{_sysconfdir}/logrotate.d/sa-update
%if %{use_systemd}
%{_unitdir}/spamassassin.service
+%{_unitdir}/sa-update.service
+%{_unitdir}/sa-update.timer
%endif
%clean
@@ -296,6 +305,7 @@ rm -rf $RPM_BUILD_ROOT
%if %{use_systemd}
%systemd_post spamassassin.service
+%systemd_post sa-update.timer
%endif
# -a and --auto-whitelist options were removed from 3.0.0
@@ -325,6 +335,7 @@ exit 0
%if %{use_systemd}
%systemd_postun spamassassin.service
+%systemd_postun sa-update.timer
%endif
%preun
@@ -338,6 +349,7 @@ exit 0
%if %{use_systemd}
%systemd_preun spamassassin.service
+%systemd_preun sa-update.timer
%endif
%if %{use_systemd}
@@ -350,6 +362,9 @@ exit 0
%endif
%changelog
+* Fri Apr 03 2015 Kevin Fenzi <kevin at scrye.com> 3.4.0-14
+- Switch to systemd timer unit from cron for rules updates. Fixes bug #1064537
+
* Fri Apr 03 2015 Kevin Fenzi <kevin at scrye.com> 3.4.0-13
- Remove last parts of portreserve. Fixes bug #1175798
- Fix typo in Razor2 plugin. Fixes bug #1208776
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/spamassassin.git/commit/?h=master&id=569fc65779ae06da957e61de866bcdec60a4c9e1
More information about the scm-commits
mailing list