Date: Thu, 10 Dec 2009 00:29:35 GMT From: Glen Barber <glen.j.barber@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/141330: [patch] mail/p5-qpsmtpd: rc script fixes Message-ID: <200912100029.nBA0TZXs030515@www.freebsd.org> Resent-Message-ID: <200912100030.nBA0U5BZ031276@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 141330 >Category: ports >Synopsis: [patch] mail/p5-qpsmtpd: rc script fixes >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Dec 10 00:30:05 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Glen Barber >Release: 8.0-STABLE >Organization: >Environment: FreeBSD orion 8.0-STABLE FreeBSD 8.0-STABLE #7 r200016: Wed Dec 2 00:18:02 EST 2009 root@orion:/usr/obj/usr/src/sys/ORION amd64 >Description: The mail/p5-qpsmtpd rc.d script: - contains a typo - does not daemonize the process by default - does not check if the process is currently running - does not provide output to STDOUT on start-up, shutdown, or when errors are encountered >How-To-Repeat: >Fix: The attached patch addresses the following: - fixes a typo following the '-u' argument - adds the '-d' (daemon) argument by default - adds sanity checking for starting/stopping the service - provides verbose output Patch attached with submission follows: diff -ruN /usr/ports/mail/p5-qpsmtpd.orig/files/qpsmtpd.in /usr/ports/mail/p5-qpsmtpd/files/qpsmtpd.in --- /usr/ports/mail/p5-qpsmtpd.orig/files/qpsmtpd.in 2008-12-25 09:55:17.000000000 -0500 +++ /usr/ports/mail/p5-qpsmtpd/files/qpsmtpd.in 2009-12-09 19:12:54.000000000 -0500 @@ -68,12 +68,33 @@ start_cmd() { - eval $command -p $qpsmtpd_port -c $qpsmtpd_max_connections -u $qpsmtpd_users -m $qpsmtpd_max_per_ip -l $qpsmtpd_listen_on --pid-file $pidfile + if [ -e $pidfile ]; then + echo "$name already running as PID `cat $pidfile`." + exit 1 + else + eval $command \ + -p $qpsmtpd_port \ + -c $qpsmtpd_max_connections \ + -u $qpsmtpd_user \ + -m $qpsmtpd_max_per_ip \ + -l $qpsmtpd_listen_on \ + --pid-file $pidfile \ + -d \ + && echo "$name started as PID `cat $pidfile`." \ + || echo "Failed to start $name" + fi } stop_cmd() { - kill `cat $pidfile` + if [ -e $pidfile ]; then + kill `cat $pidfile` \ + && echo "$name stopped." \ + || echo "Could not stop `cat $pidfile`." + else + echo "Cannot find $pidfile - $name not running?" + exit 1 + fi } run_rc_command "$1" >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912100029.nBA0TZXs030515>