diff options
author | sahil <sahil@FreeBSD.org> | 2012-06-11 02:58:16 +0800 |
---|---|---|
committer | sahil <sahil@FreeBSD.org> | 2012-06-11 02:58:16 +0800 |
commit | e110a8aa3688e389a301d5630684594eb376fb10 (patch) | |
tree | d68fc2e3318a83d4ba32e0308d6d7d68184e5f01 /mail/postfix-postfwd/files | |
parent | 811c4be9f0b92363ffcd033d9165287cd6bc9b63 (diff) | |
download | freebsd-ports-gnome-e110a8aa3688e389a301d5630684594eb376fb10.tar.gz freebsd-ports-gnome-e110a8aa3688e389a301d5630684594eb376fb10.tar.zst freebsd-ports-gnome-e110a8aa3688e389a301d5630684594eb376fb10.zip |
- Add OPTION to install postfwd v2 rather than v1 and
convert to new options framework.
- Revise the rc.d script[1] with style and functionality
improvements, one of which works around an upstream
issue that obstructed operation of 'status' and other
functions. Because this affects the default package,
bump PORTREVISION.
Reviewed by: dougb [1]
Diffstat (limited to 'mail/postfix-postfwd/files')
-rw-r--r-- | mail/postfix-postfwd/files/postfwd.in | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/mail/postfix-postfwd/files/postfwd.in b/mail/postfix-postfwd/files/postfwd.in index a2b57bd7c622..cd0087580faa 100644 --- a/mail/postfix-postfwd/files/postfwd.in +++ b/mail/postfix-postfwd/files/postfwd.in @@ -1,45 +1,63 @@ #!/bin/sh -# PROVIDE: postfwd +# $FreeBSD$ +# +# PROVIDE: postfwd # REQUIRE: LOGIN cleanvar # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # -# postfwd_enable (bool): +# postfwd_enable (bool): # Set to "NO" by default. -# Set it to "YES" to enable postfwd. -# postfwd_config (path): Set to %%PREFIX%%/etc/postfwd.conf -# by default. -# +# Set it to "YES" to enable postfwd. +# postfwd_config (path): +# Set to %%PREFIX%%/etc/postfwd.conf +# by default. . /etc/rc.subr name=postfwd rcvar=postfwd_enable -command=%%PREFIX%%/bin/${name} -required_files=%%PREFIX%%/etc/${name}.conf -pidfile="/var/run/${name}.pid" +load_rc_config $name -stop_postcmd=stop_postcmd +: ${postfwd_enable:="NO"} +: ${postfwd_flags="--shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200"} -stop_postcmd() -{ - rm -f $pidfile -} +pidfile=${postfwd_pidfile:="/var/run/${name}.pid"} +required_files=${postfwd_config:="%%PREFIX%%/etc/${name}.conf"} -load_rc_config "$name" +command=%%PREFIX%%/bin/${name} +command_args="--daemon --file=${required_files} --pidfile=${pidfile} --interface=127.0.0.1 --port=10040 --user=nobody --group=nobody" + +start_precmd="${name}_check" +status_cmd="${name}_status" +stop_cmd="${command} -k --pidfile=${pidfile}" +stop_postcmd="rm -f ${pidfile}" +extra_commands="reload" +reload_cmd="${name}_reload" + +postfwd_check() { + if [ -f "${postfwd_pidfile}" ]; then + err 1 "${name} is already running." + fi +} -case "$postfwd_enable" in - [Yy][Ee][Ss] | 1 | [Oo][Nn] | [Tt][Rr][Uu][Ee]) ;; - *) echo "To make use of $name you must first set $rcvar=\"YES\" in /etc/rc.conf" ;; -esac +postfwd_status() { + postfwd_pid=`cat ${pidfile} 2>/dev/null` + postfwd_run=`ps -U nobody | grep -m 1 ${postfwd_pid} 2>/dev/null` + if [ -n "${postfwd_pid}" -a -n "${postfwd_run}" ]; then + echo "$name is running as ${postfwd_pid}" + else + echo "$name is not running" + fi +} -: ${postfwd_enable="NO"} -: ${postfwd_config="%%PREFIX%%/etc/${name}.conf"} +postfwd_reload() { -command_args="--shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200 -d -f ${required_files} -i 127.0.0.1 -p 10040 -u nobody -g nobody" + kill -HUP `cat $pidfile` +} run_rc_command "$1" |