From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Feb 11 13:10:08 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 320711065674 for ; Fri, 11 Feb 2011 13:10:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0E7AE8FC17 for ; Fri, 11 Feb 2011 13:10:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1BDA7ga046299 for ; Fri, 11 Feb 2011 13:10:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1BDA7Nj046298; Fri, 11 Feb 2011 13:10:07 GMT (envelope-from gnats) Resent-Date: Fri, 11 Feb 2011 13:10:07 GMT Resent-Message-Id: <201102111310.p1BDA7Nj046298@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mikhail Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA9161065694 for ; Fri, 11 Feb 2011 13:08:03 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id BF5E18FC17 for ; Fri, 11 Feb 2011 13:08:03 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p1BD83PA071393 for ; Fri, 11 Feb 2011 13:08:03 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p1BD83cn071392; Fri, 11 Feb 2011 13:08:03 GMT (envelope-from nobody) Message-Id: <201102111308.p1BD83cn071392@red.freebsd.org> Date: Fri, 11 Feb 2011 13:08:03 GMT From: Mikhail To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/154682: [net/iaxmodem] add rc script for running more than 1 iaxmodem with configuration files X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2011 13:10:08 -0000 >Number: 154682 >Category: ports >Synopsis: [net/iaxmodem] add rc script for running more than 1 iaxmodem with configuration files >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: Fri Feb 11 13:10:07 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Mikhail >Release: 7.3-STABLE >Organization: Meganet >Environment: FreeBSD 7.3-STABLE FreeBSD 7.3-STABLE #1: Thu May 13 12:24:05 MSD 2010 root@gate..ru:/usr/obj/usr/src/sys/GENERIC i386 >Description: new script running more than 1 iaxmodem, it`s needed for more than 1 receiving or sending fax message >How-To-Repeat: - >Fix: new script Patch attached with submission follows: --- iaxmodem.in.orig 2011-02-11 16:00:42.000000000 +0300 +++ iaxmodem.in 2011-02-11 16:06:33.000000000 +0300 @@ -6,20 +6,50 @@ # # Add the following lines to /etc/rc.conf to enable iaxmodem: -# -# iaxmodem_enable="YES" -# +# iaxmodem_enable (bool): Set to NO by default. +# Set it to YES to enable iaxmodem. +# iaxmodem_daemons (array): +# array of names of configuration files for running modems which located in /usr/local/etc/iaxmodem/ +# EXAMPLE: +# iaxmodem_enable="YES" +# iaxmodem_daemons="ttyIAX1 ttyIAX2 ttyIAX3 ttyIAX4 ttyIAX5 ttyIAX6 ttyIAX7 ttyIAX8 ttyIAX9 ttyIAX10" . /etc/rc.subr name=iaxmodem rcvar=`set_rcvar` -command=%%PREFIX%%/sbin/iaxmodem +load_rc_config $name -pidfile=${iaxmodem_pidfile:-"/var/run/iaxmodem.pid"} +_daemon_cmd="/usr/sbin/daemon" iaxmodem_enable=${iaxmodem_enable:-"NO"} -load_rc_config $name -run_rc_command "$1" +do_cmd() { + local ret + ret=0 + for daemon in ${iaxmodem_daemons}; do + pidfile=/var/run/iaxmodem/${daemon}.pid + command="/usr/local/sbin/iaxmodem" + flags="-fp ${pidfile} /usr/local/sbin/iaxmodem ${daemon}" + name="iaxmodem_${daemon}" + case "$1" in + restart) + run_rc_command "stop" + command=${_daemon_cmd} + run_rc_command "start" + ;; + start) + command=${_daemon_cmd} + run_rc_command "$1" || ret=1 + ;; + *) + run_rc_command "$1" + ;; + esac + _rc_restart_done=false + done + return ${ret} +} + +do_cmd "$1" >Release-Note: >Audit-Trail: >Unformatted: