Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Apr 2002 11:32:32 +0300
From:      "Toomas Aas" <toomas.aas@raad.tartu.ee>
To:        f3z <f3z@iprimus.com.au>, freebsd-questions@freebsd.org
Subject:   Re: stuipid question - safe way to start apache in rc.d
Message-ID:  <200204160834.g3G8Ycc05195@lv.raad.tartu.ee>
In-Reply-To: <B8E20291.419%f3z@iprimus.com.au>

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

> I have compiled apache from source (so that I can do customisations and the
> like) and would like it to start at boot time, what sort of script should I
> put in rc.d? I already have some rather complicated mysql ones in there . .
> . would there be any problem with just saying:
> 
>   #!/bin/sh
>   /dir/httpd/bin/apachectl startssl

That would probably work (provided you are not required to enter any 
passphrases manually), but it's somewhat less than ideal.

The scripts in rc.d are run with argument 'start' at system startup 
time and with argument 'stop' at system shutdown time. With your 
script the system would also try to start (another copy of) Apache 
when system is being shut down.

I would modify the script to something like that:

------------------------------------------------------------
#!/bin/sh
case "$1" in
start)
        /dir/httpd/bin/apachectl startssl && echo -n ' httpd'
        ;;
stop)
        /dir/httpd/bin/apachectl stop
        ;;
*)
        echo ""
        echo "usage: httpd.sh {start|stop}" >&2
        echo ""
        ;;
esac
--------------------------------------------------------------

Note that I am not a shell script wizard, the above is just a quick 
modification of the only rc.d script I have ever written :-)
--
Toomas Aas | toomas.aas@raad.tartu.ee | http://www.raad.tartu.ee/~toomas/
* A preposition is a bad thing to end a sentence with.


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?200204160834.g3G8Ycc05195>