ports/141330: [patch] mail/p5-qpsmtpd: rc script fixes
Glen Barber
glen.j.barber at gmail.com
Thu Dec 10 00:30:05 UTC 2009
>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 at 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:
More information about the freebsd-ports-bugs
mailing list