ports/94895: [PATCH] mail/postgrey: The shutting donw process of postgrey is incorrect.
Masanori OZAWA
ozawa at ongs.co.jp
Fri Mar 24 06:10:15 UTC 2006
>Number: 94895
>Category: ports
>Synopsis: [PATCH] mail/postgrey: The shutting donw process of postgrey is incorrect.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Mar 24 06:10:14 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Masanori OZAWA
>Release: FreeBSD 6.0-RELEASE-p6
>Organization:
ONGS Inc.
>Environment:
FreeBSD mithos.ongs.co.jp 6.0-RELEASE-p6 FreeBSD 6.0-RELEASE-p6 #0: Thu Mar 23 12:16:26 JST 2006 root at mithos.ongs.co.jp:/usr/obj/usr/src/sys/MITHOS i386
>Description:
The shutting donw process of postgrey is incorrect.
That causes a problem that DB gets broken and postgrey cannot work.
>How-To-Repeat:
# /usr/local/etc/rc.d/postgrey.sh start
# /usr/local/etc/rc.d/postgrey.sh stop
postgrey already running? (pid=/var/run/postgrey.pid)
>Fix:
I think that you could choice from some solutions.
One of the solutions as follow:
--- postgrey.sh.orig Fri Mar 24 13:46:00 2006
+++ postgrey.sh Fri Mar 24 14:48:28 2006
@@ -24,14 +24,8 @@
required_dirs=/var/db/postgrey
extra_commands=reload
-stop_postcmd=stop_postcmd
-
-stop_postcmd()
-{
- rm -f $pidfile
-}
-
# set defaults
+load_rc_config $name
postgrey_enable=${postgrey_enable:-"NO"}
postgrey_pidfile=${postgrey_pidfile:-"/var/run/postgrey.pid"}
@@ -40,5 +34,49 @@
pidfile="${postgrey_pidfile}"
-load_rc_config $name
-run_rc_command "$1"
+get_postgrey_pid()
+{
+ local pid -
+ local junk -
+
+ if [ -z "${pidfile}" ]; then
+ echo "you need to set postgrey_pidfile variable."
+ return 0
+ fi
+ if [ ! -f "${pidfile}" ]; then
+ return 0
+ fi
+
+ read pid junk < ${pidfile}
+ if [ -z "${pid}" ]; then
+ return 0
+ fi
+
+ return ${pid}
+}
+
+if [ "$1" = "start" ]; then
+ if ! get_postgrey_pid ; then
+ echo "${name} already running. (pid=${pidfile})"
+ exit 0
+ fi
+ run_rc_command "$1"
+elif [ "$1" = "stop" ]; then
+ get_postgrey_pid
+ pid=$?
+ if [ "0" = "${pid}" ]; then
+ echo "${name} already running? (pid=${pidfile})"
+ exit 1
+ fi
+
+ psinfo=`ps -p "${pid}" | grep -e postgrey -e perl | grep -v grep`
+ if [ -n "$psinfo" ]; then
+ kill -TERM ${pid}
+ rm -f ${pidfile}
+ else
+ echo "${name} already running? (pid=${pidfile})"
+ fi
+else
+ run_rc_command "$1"
+fi
+
It is serious. By this problem, some folks got DB broken and postgrey did not work.
I think it should be fixed ASAP.
Thanks.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list