Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 2004 12:28:59 +0000
From:      Tim Bishop <tim@bishnet.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        tim@bishnet.net
Subject:   ports/74512: [MAINTAINER] misc/dnetc: Improve RC script
Message-ID:  <E1CYkeJ-0006Bq-4j@pendennis.ukc.ac.uk>
Resent-Message-ID: <200411291230.iATCUMnS029636@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         74512
>Category:       ports
>Synopsis:       [MAINTAINER] misc/dnetc: Improve RC script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 29 12:30:22 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Tim Bishop
>Release:        FreeBSD 5.2.1-RELEASE-p9 i386
>Organization:
>Environment:
System: FreeBSD pendennis.ukc.ac.uk 5.2.1-RELEASE-p9 FreeBSD 5.2.1-RELEASE-p9 #1: Sun Jul 18 15:23:54 BST 2004
>Description:
Improve RC scripts. The previous script didn't check if the process
was already running before attempting to start a new one (or if it
was running before stopping it). This improved version does the
necessary checks.

Pointed out by: Radim Kolar

Generated with FreeBSD Port Tools 0.63
>How-To-Repeat:
>Fix:

--- dnetc-2.9008.491_1,1.patch begins here ---
Index: Makefile
===================================================================
RCS file: /u1/freebsd/cvs/ports/misc/dnetc/Makefile,v
retrieving revision 1.46
diff -u -r1.46 Makefile
--- Makefile	15 Nov 2004 21:54:23 -0000	1.46
+++ Makefile	29 Nov 2004 12:27:23 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	dnetc
 PORTVERSION=	${VERSION}
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	misc
 MASTER_SITES=	ftp://ftp.distributed.net/pub/dcti/%SUBDIR%/ \
Index: files/dnetc.sh
===================================================================
RCS file: /u1/freebsd/cvs/ports/misc/dnetc/files/dnetc.sh,v
retrieving revision 1.7
diff -u -r1.7 dnetc.sh
--- files/dnetc.sh	15 Nov 2004 21:54:24 -0000	1.7
+++ files/dnetc.sh	29 Nov 2004 12:23:59 -0000
@@ -23,14 +23,22 @@
 
 dnetc_start()
 {
-	echo -n " dnetc"
-	su -m ${user} -c "${dir}/dnetc -quiet" 2>/dev/null >/dev/null
+	if ps -U${user} >/dev/null; then
+		echo "${name} already running?"
+	else
+		su -m ${user} -c "${dir}/${name} -quiet" >/dev/null 2>&1
+		echo -n " ${name}"
+	fi
 }
 
 dnetc_stop()
 {
-	su -m ${user} -c "${dir}/dnetc -shutdown" 2>/dev/null >/dev/null
-	echo -n " dnetc"
+	if ps -U${user} >/dev/null; then
+		su -m ${user} -c "${dir}/${name} -shutdown" >/dev/null 2>&1
+		echo -n " ${name}"
+	else
+		echo "${name} not running?"
+	fi
 }
 
 load_rc_config $name
--- dnetc-2.9008.491_1,1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1CYkeJ-0006Bq-4j>