diff options
author | Philip M. Gollucci <pgollucci@FreeBSD.org> | 2010-01-03 21:17:21 +0000 |
---|---|---|
committer | Philip M. Gollucci <pgollucci@FreeBSD.org> | 2010-01-03 21:17:21 +0000 |
commit | ada9c889a7c4d051709c22d4b767f97ce576032b (patch) | |
tree | 76dbd95814872b9332b7f36ce3620d80d2f4cf0b /mail/p5-qpsmtpd | |
parent | 766ab75197a47bfccb44e217457fd86bebaaad82 (diff) |
Notes
Diffstat (limited to 'mail/p5-qpsmtpd')
-rw-r--r-- | mail/p5-qpsmtpd/Makefile | 1 | ||||
-rw-r--r-- | mail/p5-qpsmtpd/files/qpsmtpd.in | 122 |
2 files changed, 40 insertions, 83 deletions
diff --git a/mail/p5-qpsmtpd/Makefile b/mail/p5-qpsmtpd/Makefile index 9c92774a6cae..99e6cfe8c09a 100644 --- a/mail/p5-qpsmtpd/Makefile +++ b/mail/p5-qpsmtpd/Makefile @@ -36,6 +36,7 @@ MAN3= Qpsmtpd::Command.3 \ USE_RC_SUBR= qpsmtpd +SUB_LIST+= PERL=${PERL} SUB_LIST+= PORTNAME=${PORTNAME} SUB_FILES+= pkg-message diff --git a/mail/p5-qpsmtpd/files/qpsmtpd.in b/mail/p5-qpsmtpd/files/qpsmtpd.in index 2c6866ff4a17..d231a17ac68c 100644 --- a/mail/p5-qpsmtpd/files/qpsmtpd.in +++ b/mail/p5-qpsmtpd/files/qpsmtpd.in @@ -1,100 +1,56 @@ #!/bin/sh +# $FreeBSD$ +# # PROVIDE: qpsmtpd -# REQUIRE: NETWORKING SERVERS -# BEFORE: securelevel - -#variables -#qpsmtpd_user = the user to run qpsmtpd-forkserver under -#qpsmtpd_group = the group the pid dir will be chowned to -#qpsmtpd_port = the port it should listen on -#qpsmtpd_max_per_ip = max connections per IP -#qpsmtpd_max_connections = maximum total connections -#qpsmtpd_listen_on = IP to listen on - -. "/etc/rc.subr" +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# qpsmtpd_enable (bool): Set to NO by default +# Set it to YES to enable qpsmtpd +# qpsmtpd_user (string): Set to "nobody" by default +# The user to run qpsmtpd-forkserver as +# qpsmtpd_group (string): Set to "nogroup" by default +# The group the pid dir will be chowned to +# qpsmtpd_port (int): Set to 2525 by default +# The port it should listen on +# qpsmtpd_max_per_ip (int): Set to 3 by default +# Max connections per IP +# qpsmtpd_max_connections (int): Set to 15 by default +# Maximum total connections +# qpsmtpd_listen_on (address): Set to 0.0.0.0 by default +# IP address to listen on + +. /etc/rc.subr name="qpsmtpd" rcvar=`set_rcvar` -load_rc_config $name command="%%PREFIX%%/bin/qpsmtpd-forkserver" +command_interpreter=%%PERL%% pidfile="/var/run/qpsmtpd/qpsmtpd.pid" -start_precmd="start_precmd" -start_cmd="start_cmd" -stop_cmd="stop_cmd" +start_precmd=${name}_prestart -start_precmd() +qpsmtpd_prestart() { - #exits if no user is specified - if [ -z $qpsmtpd_user ]; then - echo "qpsmtpd_user not set" - exit 1 - fi - - #exits if no group is specified - if [ -z $qpsmtpd_group ]; then - echo "qpsmtpd_group not set" - exit 1 - fi - - #sets it to the default if the port is not specified - if [ -z $qpsmtpd_port ]; then - qpsmtpd_port="2525" - fi - - #set it to the default max per ip - if [ -z $qpsmtpd_max_per_ip ]; then - qpsmtpd_max_per_ip="5" - fi - - #set it do the max number of connections total - if [ -z $qpsmtpd_max_connections ]; then - qpsmtpd_max_connections="15" - fi - - #set the default listen on to everything - if [ -z $qpsmtpd_listen_on ]; then - qpsmtpd_listen_on="0.0.0.0" - fi - - if [ ! -d /var/run/qpsmtpd/ ] ; then - mkdir /var/run/qpsmtpd - fi - - chown $qpsmtpd_user:$qpsmtpd_group /var/run/qpsmtpd + [ -d /var/run/qpsmtpd ] || mkdir /var/run/qpsmtpd + chown $qpsmtpd_user:$qpsmtpd_group /var/run/qpsmtpd } -start_cmd() -{ - 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 -} +load_rc_config $name -stop_cmd() -{ - 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 -} +: ${qpsmtpd_enable="NO"} +: ${qpsmtpd_user="nobody"} +: ${qpsmtpd_group="nogroup"} +: ${qpsmtpd_port="2525"} +: ${qpsmtpd_max_per_ip="3"} +: ${qpsmtpd_max_connections="15"} +: ${qpsmtpd_listen_on="0.0.0.0"} + +command_args="-d -p $qpsmtpd_port -c $qpsmtpd_max_connections -u $qpsmtpd_user -m $qpsmtpd_max_per_ip -l $qpsmtpd_listen_on --pid-file $pidfile" run_rc_command "$1" |