From owner-freebsd-questions Fri Jan 12 12: 8:22 2001 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-10.mail.nl.demon.net [194.159.73.20]) by hub.freebsd.org (Postfix) with ESMTP id C1A7D37B402 for ; Fri, 12 Jan 2001 12:08:02 -0800 (PST) Received: from [212.238.77.116] (helo=willow.raggedclown.net) by post.mail.nl.demon.net with smtp (Exim 3.14 #2) id 14HAUP-00009F-00; Fri, 12 Jan 2001 20:08:00 +0000 Received: from buffy.raggedclown.net (btvs.demon.nl [192.168.1.2]) by willow.raggedclown.net (Postfix) with ESMTP id D42125DA2; Fri, 12 Jan 2001 21:07:16 +0100 (CET) Received: by buffy.raggedclown.net (Postfix on SuSE Linux 7.0 (i386), from userid 500) id BF79F12C20; Fri, 12 Jan 2001 20:31:26 +0100 (CET) Date: Fri, 12 Jan 2001 20:31:26 +0100 From: Cliff Sarginson To: Mark Rowlands Cc: Langa Kentane , "'questions@freebsd.org'" Subject: Re: starting a daemon automatically at startup. Message-ID: <20010112203126.A986@buffy.raggedclown.net> References: <01011121380900.00305@web1.tninet.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <01011121380900.00305@web1.tninet.se>; from mark.rowlands@minmail.net on Thu, Jan 11, 2001 at 09:38:09PM +0100 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Jan 11, 2001 at 09:38:09PM +0100, Mark Rowlands wrote: > On Thursday 11 January 2001 08:18, Langa Kentane wrote: > > Greetings. > > I have just install ntop on a server running FreeBSD 4.1.1-RELEASE. Now I > > need to start this with the following flags at boot time: '-dw 3000' > > > > How do I go about doing this? > > Thanks in advance. > > > > I believe the official way...and I am putting this in the hope that some one > authoritative will correct this as appropriate because I have seen several > opinions offered, is to provide a script in rc.d which will take a "start" > and a "stop" option > > in /usr/local/etc/rc.d create a shell script looking something like this > > #!/bin/sh > Just a little correction :) The user may forget to give an argument, so $1 may be non-existant and you will get a bitch from the shell.. so when in doubt .. quote $ vars.. Cliff > case "$1" in > > start) > if [ -x /usr/local/etc/myapp/start ]; then > /usr/local/etc/myapp/start >/dev/null > echo -n ' myapp' > fi > ;; > > stop) > if [ -x /usr/local/etc/myapp/stop ]; then > /usr/local/etc/myapp/stop >/dev/null > echo -n ' myapp' > fi > ;; > > *) > echo "usage: `basename $0` {start|stop}" >&2 > exit 64 > ;; > esac > > > > create some directory /usr/local/etc/myapp > with two commands stop and start with whatever is appropriate to stop and > start the applications in an orderly fashion. Clearly if your application > has existing commands these can be utilised from the appropriate directory > > sample stop script > > #!/bin/sh > echo Stopping myapp in /usr/local/myapp > kill `cat /var/log/myapp.pid` > > now let the flames roll ;-) Hey, no-one should get flamed for passing on what they know :) .. no worries, the *slightest* mistake here will get spotted .. roflmao.. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message