Bug 99322 - [net-mgmt/netams] rc.d script doesn't check if daemoin is already started
Summary: [net-mgmt/netams] rc.d script doesn't check if daemoin is already started
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Ion-Mihai "IOnut" Tetcu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-22 22:10 UTC by Vasiliy P. Melnik
Modified: 2006-06-26 23:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy P. Melnik 2006-06-22 22:10:16 UTC
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)

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.
How-To-Repeat: if starting netams from rc.d script some times
Comment 1 Ion-Mihai "IOnut" Tetcu freebsd_committer freebsd_triage 2006-06-23 19:44:41 UTC
State Changed
From-To: open->feedback

Recalsiffy and take. Ask for maintainer feedback. 


Comment 2 Ion-Mihai "IOnut" Tetcu freebsd_committer freebsd_triage 2006-06-23 19:44:41 UTC
Responsible Changed
From-To: freebsd-i386->itetcu

Recalsiffy and take. Ask for maintainer feedback.
Comment 3 Yuriy N. Shkandybin 2006-06-26 09:30:32 UTC
Pro
Comment 4 Ion-Mihai "IOnut" Tetcu freebsd_committer freebsd_triage 2006-06-26 23:00:23 UTC
State Changed
From-To: feedback->closed

Commiter with fixes; next time please submit diffs.