Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2001 21:38:09 +0100
From:      Mark Rowlands <mark.rowlands@minmail.net>
To:        Langa Kentane <LangaK@discoveryhealth.co.za>, "'questions@freebsd.org'" <questions@FreeBSD.ORG>
Subject:   Re: starting a daemon automatically at startup.
Message-ID:  <01011121380900.00305@web1.tninet.se>
In-Reply-To: <A69BC9CA4B39D411BF2200105A45B45B075B8C03@dhexchange.discoveryhealth.co.za>
References:  <A69BC9CA4B39D411BF2200105A45B45B075B8C03@dhexchange.discoveryhealth.co.za>

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

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 ;-)


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?01011121380900.00305>