Click to See Complete Forum and Search --> : apache auto start


Chatterjee
03-18-2001, 08:20 PM
How can i have apache (or any other command) automatically start up when a server is rebooted?

-S

johnwebb
03-20-2001, 02:00 AM
If you installed Apache in the default location you can create the following symlinks to have it start on boot.

ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd

ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc0.d/K15httpd

ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc6.d/K15httpd

ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S85httpd

ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd

Chatterjee
03-20-2001, 02:20 AM
thanks for your help... i'll give that a whirl. In the meantime, can you explain what those commands mean/do?

Where can i get more information on this?

-S

johnwebb
03-21-2001, 12:01 AM
apachectl is used to control Apache start, shutdown, reload, ect ...

/usr/local/apache/bin/apachectl start

/etc/rc.d/init.d is the directory were start-up and shut-down scripts are kept (at least on RedHat).

rc0.d and rc6.d are used for shut-down and reboot.

rc3.d and rc5.d are used for start-up, 3=console, 5=X-windows.

ln is a link, the -s make it symbolic.

ln -s from-this-real-file to-this-link-name

The default location for apachectl when Apache is installed from source code is

/usr/local/apache/bin/apachectl

to make this script available for start-up and shut-down you create a link

ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd

the links in rcX.d directories have "magic" power, when prefixed with a S or K start or stop is apended to to the call

K15httpd = httpd stop

following the links back it ends up being

/usr/local/apache/bin/apachectl stop

which shuts down Apache

When you change run levels all the links in rcX.d are run.

johnwebb
03-21-2001, 12:15 AM
More info ... http://www.linux-mag.com/2000-12/start_01.html