Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2002 03:42:01 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Ryan Hill <rhill@xypoint.com>
Cc:        "'freebsd-questions@freebsd.org'" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: preferred method to start daemons
Message-ID:  <20020423004201.GC3341@hades.hell.gr>
In-Reply-To: <38985D9205A0D411A10500508B10DE66029974E6@ebert.xypoint.com>
References:  <38985D9205A0D411A10500508B10DE66029974E6@ebert.xypoint.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2002-04-22 17:06, Ryan Hill wrote:
> Soooo, I've got a bit of chicken vs. the egg problem here.  I have a
> mysql.server script placed in rc.d, but I'm unsure where to call it in the
> startup process to actually start the server.  I've also tried hacking
> together a startup script for apache, but it bombs horribly when I try to
> execute it manually for testing.

Both methods (/etc/rc.local vs. /usr/local/etc/rc.d/PROGRAM.sh) work
equally well.  Here's what I put in a file called apache.sh in my
/usr/local/etc/rc.d/ directory a few days back when I installed apache
at home:

	% ls -l /usr/local/etc/rc.d/apache.sh
	-rwxr-xr-x  1 root  wheel  - 263 Apr 20 19:15 /usr/local/etc/rc.d/apache.sh

	% cat /usr/local/etc/rc.d/apache.sh
	#!/bin/sh

	case $1 in
	start)
		echo -n ' apache'
		/home/httpd/bin/apachectl start 2>&1 >/dev/null ||\
		    echo -n ':FAILED'
		;;
	stop)
		echo -n ' apache'
		/home/httpd/bin/apachectl stop 2>&1 >/dev/null ||\
		    echo -n ':FAILED'
		;;
	*)
		echo "usage: $0 {start|stop}"
		;;
	esac

Your script has to be executable by root and have an extension of .sh
for the boot scripts to pick it up and run it automatically at boot
and shutdown time.  I think this is written in the Handbook.  If it
isn't, then it's a bug and please let me know what part you were
reading so it can be fixed :-)

Giorgos Keramidas                       FreeBSD Documentation Project
keramida@{freebsd.org,ceid.upatras.gr}  http://www.FreeBSD.org/docproj/

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?20020423004201.GC3341>