Fix sa-update to handle systemctl or service as the case may be.

This commit is contained in:
Kevin Fenzi 2015-06-07 19:47:30 -06:00
parent d237250754
commit a7348377a3
2 changed files with 17 additions and 8 deletions

View File

@ -9,11 +9,10 @@
unset SAUPDATE OPTIONS DEBUG NOTIFY_UPD
[ -f /etc/sysconfig/sa-update ] && . /etc/sysconfig/sa-update
[ "$SAUPDATE" = "no" ] && exit 0
for daemon in spamd amavisd spampd; do
for daemon in mimedefang spamd amavisd spampd; do
/usr/bin/pgrep -f $daemon >& /dev/null
[ $? -eq 0 ] && SAUPDATE=yes
done
systemctl --quiet is-active mimedefang.service; [ $? -eq 0 ] && SAUPDATE=yes
# Skip sa-update if daemon not detected
[ -z "$SAUPDATE" ] && exit 0
@ -68,10 +67,18 @@ if [ $status -eq 0 ]; then
else
echo "$now: SpamAssassin: Update processed successfully" >>/var/log/sa-update.log
fi
systemctl condrestart spamassassin.service >& /dev/null
[ -f /usr/lib/systemd/system/amavisd.service ] && systemctl condrestart amavisd.service >& /dev/null
systemctl --quiet is-active mimedefang.service; [ $? -eq 0 ] && systemctl reload mimedefang.service >& /dev/null
[ -f /usr/lib/systemd/system/spampd.service ] && systemctl condrestart spampd.service >& /dev/null
if [ -f /usr/bin/systemctl ]; then
systemctl condrestart spamassassin.service >& /dev/null
[ -f /usr/lib/systemd/system/amavisd.service ] && systemctl condrestart amavisd.service >& /dev/null
systemctl --quiet is-active mimedefang.service; [ $? -eq 0 ] && systemctl reload mimedefang.service >& /dev/null
[ -f /usr/lib/systemd/system/spampd.service ] && systemctl condrestart spampd.service >& /dev/null
else
service spamassassin condrestart >& /dev/null
[ -f /etc/rc.d/init.d/amavisd ] && service amavisd-new condrestart >& /dev/null
[ -f /etc/rc.d/init.d/mimedefang ] && service mimedefang condrestart >& /dev/null
[ -f /etc/rc.d/init.d/spampd ] && service spampd condrestart >& /dev/null
fi
exit $status
fi
if [ $status -eq 1 ]; then

View File

@ -63,7 +63,7 @@ Summary: Spam filter for email which can be invoked from mail delivery agents
Name: spamassassin
Version: 3.4.1
#Release: 0.8.%{prerev}%{?dist}
Release: 3%{?dist}
Release: 4%{?dist}
License: ASL 2.0
Group: Applications/Internet
URL: http://spamassassin.apache.org/
@ -251,7 +251,6 @@ fi
find $RPM_BUILD_ROOT%{perl_vendorlib}/* -type d -print |
sed "s@^$RPM_BUILD_ROOT@%dir @g" >> %{name}-%{version}-filelist
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/spamassassin
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/spamassassin
# sa-update channels and keyring directory
@ -351,6 +350,9 @@ exit 0
%endif
%changelog
* Sun Jun 07 2015 Kevin Fenzi <kevin@scrye.com> 3.4.1-4
- Fix sa-update to handle systemctl or service as the case may be.
* Sat Jun 06 2015 Jitka Plesnikova <jplesnik@redhat.com> - 3.4.1-3
- Perl 5.22 rebuild