From 4a5f8b43c6abb66734a9c8569727299fdf00b745 Mon Sep 17 00:00:00 2001 From: pgollucci Date: Thu, 10 Dec 2009 05:07:07 +0000 Subject: Apply the following fixes to the 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 PR: ports/141330 Submitted by: Glen Barber --- mail/p5-qpsmtpd/files/qpsmtpd.in | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'mail/p5-qpsmtpd') diff --git a/mail/p5-qpsmtpd/files/qpsmtpd.in b/mail/p5-qpsmtpd/files/qpsmtpd.in index 7ec7533403b..2c6866ff4a1 100644 --- a/mail/p5-qpsmtpd/files/qpsmtpd.in +++ b/mail/p5-qpsmtpd/files/qpsmtpd.in @@ -68,12 +68,33 @@ start_precmd() 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" -- cgit