Date: Fri, 24 Mar 2006 06:08:23 GMT From: Masanori OZAWA <ozawa@ongs.co.jp> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/94895: [PATCH] mail/postgrey: The shutting donw process of postgrey is incorrect. Message-ID: <200603240608.k2O68ND3034346@www.freebsd.org> Resent-Message-ID: <200603240610.k2O6AENo063258@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603240608.k2O68ND3034346>