From nobody@FreeBSD.org  Thu Jun 22 21:04:36 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 00A3D16A47C
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 22 Jun 2006 21:04:36 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B72FA43D48
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 22 Jun 2006 21:04:35 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k5ML4Z84057632
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 22 Jun 2006 21:04:35 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k5ML4Zf0057631;
	Thu, 22 Jun 2006 21:04:35 GMT
	(envelope-from nobody)
Message-Id: <200606222104.k5ML4Zf0057631@www.freebsd.org>
Date: Thu, 22 Jun 2006 21:04:35 GMT
From: "Vasiliy P. Melnik" <basil@gu.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: rc.d script netams truble (net-mgmt/netams)
X-Send-Pr-Version: www-2.3

>Number:         99322
>Category:       ports
>Synopsis:       [net-mgmt/netams] rc.d script doesn't check if daemoin is already started
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    itetcu
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 22 21:10:16 GMT 2006
>Closed-Date:    Mon Jun 26 22:00:26 GMT 2006
>Last-Modified:  Mon Jun 26 22:00:26 GMT 2006
>Originator:     Vasiliy P. Melnik
>Release:        6.1
>Organization:
GU ISP
>Environment:
FreeBSD nychka.gu.net 6.1-RELEASE-p1 FreeBSD 6.1-RELEASE-p1 #0: Tue Jun  6 14:09:48 EEST 2006     root@nychka.gu.net:/usr/obj/usr/src/sys/NYCHKA  i386

>Description:
if starting netams from rc.d script some times, run-daemon scrip does not check if daemoin is started and it start daemon again

[12:04] ffu:~ ]#/usr/local/etc/rc.d/netams start
Starting netams.
[12:04] ffu:~ ]#/usr/local/etc/rc.d/netams start
Starting netams.
[12:04] ffu:~ ]#/usr/local/etc/rc.d/netams start
Starting netams.
[12:04] ffu:~ ]#lsof -i | grep netams
netams    21222     root    4u  IPv4 0xc17e11d0      0t0  TCP localhost:20001 (LISTEN)
netams    21222     root    4u  IPv4 0xc17e11d0      0t0  TCP localhost:20001 (LISTEN)
netams    21222     root    4u  IPv4 0xc17e11d0      0t0  TCP localhost:20001 (LISTEN)
netams    21222     root    4u  IPv4 0xc17e11d0      0t0  TCP localhost:20001 (LISTEN)
netams    21222     root    4u  IPv4 0xc17e11d0      0t0  TCP localhost:20001 (LISTEN)
netams    21231     root    4u  IPv4 0xc1db3ae0      0t0  TCP *:* (CLOSED)
netams    21231     root    4u  IPv4 0xc1db3ae0      0t0  TCP *:* (CLOSED)
netams    21231     root    4u  IPv4 0xc1db3ae0      0t0  TCP *:* (CLOSED)
netams    21231     root    4u  IPv4 0xc1db3ae0      0t0  TCP *:* (CLOSED)
netams    21240     root    4u  IPv4 0xc17a1570      0t0  TCP *:* (CLOSED)
netams    21240     root    4u  IPv4 0xc17a1570      0t0  TCP *:* (CLOSED)
netams    21240     root    4u  IPv4 0xc17a1570      0t0  TCP *:* (CLOSED)
netams    21240     root    4u  IPv4 0xc17a1570      0t0  TCP *:* (CLOSED)

>How-To-Repeat:
if starting netams from rc.d script some times
>Fix:
[0:00] nychka:/usr/ports ]#cat /usr/local/etc/rc.d/netams
#!/bin/sh
# $FreeBSD: ports/net-mgmt/netams/files/netams.sh.in,v 1.1 2006/06/14 12:08:24 pav Exp $

foxed rc.d script

[0:01] nychka:/usr/ports ]#cat /usr/local/etc/rc.d/netams
---------------------------------------------------------------------
# PROVIDE: netams
# REQUIRE: NETWORKING
# KEYWORD: shutdown

# Add the following line to /etc/rc.conf to enable netams
#
# netams_enable (bool):         Set to "NO" by default.
#                               Set it to "YES" to enable netams.
# netams_config (str):          Custom configuration file to be passed
#                               to netams.
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#

. /etc/rc.subr

name="netams"
rcvar=`set_rcvar`

load_rc_config $name

:${netams_enable="NO"}
:${netams_config="/usr/local/etc/netams.cfg"}

pidfile="/var/run/netams.pid"
command="/usr/local/libexec/netams"
command_args="-lf ${netams_config} > /dev/null &"

run_rc_command "$1"
----------------------------------------------------------------



[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams start
netams already running? (pid=5530).
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams start
netams already running? (pid=5530).
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams start
netams already running? (pid=5530).
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams start
netams already running? (pid=5530).
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams stop
Stopping netams.
Waiting for PIDS: 5530.
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams stop
netams not running? (check /var/run/netams.pid).
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams start
Starting netams.
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams start
netams already running? (pid=70294).
[0:03] nychka:~ ]#/usr/local/etc/rc.d/netams restart
Stopping netams.
Waiting for PIDS: 70294.
Starting netams.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: itetcu 
State-Changed-When: Fri Jun 23 18:44:41 UTC 2006 
State-Changed-Why:  
Recalsiffy and take. Ask for maintainer feedback. 


Responsible-Changed-From-To: freebsd-i386->itetcu 
Responsible-Changed-By: itetcu 
Responsible-Changed-When: Fri Jun 23 18:44:41 UTC 2006 
Responsible-Changed-Why:  
Recalsiffy and take. Ask for maintainer feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=99322 

From: "Yuriy N. Shkandybin" <jura@netams.com>
To: <bug-followup@FreeBSD.org>,
	"Vasiliy P. Melnik" <basil@gu.net>
Cc:  
Subject: Re: ports/99322: [net-mgmt/netams] rc.d script doesn't check if daemoin is already started
Date: Mon, 26 Jun 2006 12:30:32 +0400

 Pro
State-Changed-From-To: feedback->closed 
State-Changed-By: itetcu 
State-Changed-When: Mon Jun 26 22:00:23 UTC 2006 
State-Changed-Why:  
Commiter with fixes; next time please submit diffs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=99322 
>Unformatted:
