Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jan 2001 20:31:26 +0100
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        Mark Rowlands <mark.rowlands@minmail.net>
Cc:        Langa Kentane <LangaK@discoveryhealth.co.za>, "'questions@freebsd.org'" <questions@FreeBSD.ORG>
Subject:   Re: starting a daemon automatically at startup.
Message-ID:  <20010112203126.A986@buffy.raggedclown.net>
In-Reply-To: <01011121380900.00305@web1.tninet.se>; from mark.rowlands@minmail.net on Thu, Jan 11, 2001 at 09:38:09PM %2B0100
References:  <A69BC9CA4B39D411BF2200105A45B45B075B8C03@dhexchange.discoveryhealth.co.za> <01011121380900.00305@web1.tninet.se>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010112203126.A986>