Browse Source

fix logging; fix stopping; fix run-runtime UID switchig; fix... well, just fix everything.

master
parent
commit
a3589f2d95
  1. 17
      postgrey/postgrey.spec
  2. 10
      postgrey/rc.postgrey

17
postgrey/postgrey.spec

@ -34,7 +34,7 @@ Class: PLUS
Group: Mail Group: Mail
License: GPL License: GPL
Version: 1.16 Version: 1.16
Release: 20041011 Release: 20041208
# list of sources # list of sources
Source0: http://isg.ee.ethz.ch/tools/postgrey/pub/postgrey-%{version}.tar.gz Source0: http://isg.ee.ethz.ch/tools/postgrey/pub/postgrey-%{version}.tar.gz
@ -90,6 +90,7 @@ AutoReqProv: no
# install programs and manual pages # install programs and manual pages
%{l_shtool} install -c -m 755 \ %{l_shtool} install -c -m 755 \
-e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \ -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
-e "s;\\(.\\)Sys::Syslog\\(. : undef\\);\\1%{l_prefix}/var/postgrey/postgrey.log\\2;" \
postgrey $RPM_BUILD_ROOT%{l_prefix}/sbin/ postgrey $RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 755 \ %{l_shtool} install -c -m 755 \
-e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \ -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
@ -124,3 +125,17 @@ AutoReqProv: no
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%post
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} postgrey status 2>/dev/null`
[ ".$postgrey_active" = .yes ] && %{l_rc} postgrey restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} postgrey stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/postgrey/*
exit 0

10
postgrey/rc.postgrey

@ -14,7 +14,7 @@
postgrey_log_complevel="9" postgrey_log_complevel="9"
%common %common
postgrey_logfile="@l_prefix@/var/postgrey/postgrey.pid" postgrey_logfile="@l_prefix@/var/postgrey/postgrey.log"
postgrey_pidfile="@l_prefix@/var/postgrey/postgrey.pid" postgrey_pidfile="@l_prefix@/var/postgrey/postgrey.pid"
postgrey_socket="@l_prefix@/var/postgrey/postgrey.socket" postgrey_socket="@l_prefix@/var/postgrey/postgrey.socket"
postgrey_dbdir="@l_prefix@/var/postgrey" postgrey_dbdir="@l_prefix@/var/postgrey"
@ -25,11 +25,13 @@
%status -u @l_rusr@ -o %status -u @l_rusr@ -o
postgrey_usable="unknown" postgrey_usable="unknown"
postgrey_active="no" postgrey_active="no"
rcService postgrey enable yes && \
postgrey_signal 0 && postgrey_active="yes"
echo "postgrey_enable=\"$postgrey_enable\"" echo "postgrey_enable=\"$postgrey_enable\""
echo "postgrey_usable=\"$postgrey_usable\"" echo "postgrey_usable=\"$postgrey_usable\""
echo "postgrey_active=\"$postgrey_active\"" echo "postgrey_active=\"$postgrey_active\""
%start -u @l_susr@ %start -u @l_rusr@
rcService postgrey enable yes || exit 0 rcService postgrey enable yes || exit 0
rcService postgrey active yes && exit 0 rcService postgrey active yes && exit 0
@l_prefix@/sbin/postgrey \ @l_prefix@/sbin/postgrey \
@ -41,13 +43,13 @@
--delay=$postgrey_delay \ --delay=$postgrey_delay \
--max-age=$postgrey_maxage --max-age=$postgrey_maxage
%stop -u @l_susr@ %stop -u @l_rusr@
rcService postgrey enable yes || exit 0 rcService postgrey enable yes || exit 0
rcService postgrey active no && exit 0 rcService postgrey active no && exit 0
postgrey_signal TERM postgrey_signal TERM
rm -f $postgrey_pidfile 2>/dev/null || true rm -f $postgrey_pidfile 2>/dev/null || true
%restart -u @l_susr@ %restart -u @l_rusr@
rcService postgrey enable yes || exit 0 rcService postgrey enable yes || exit 0
rcService postgrey active no && exit 0 rcService postgrey active no && exit 0
rc postgrey stop rc postgrey stop

Loading…
Cancel
Save