brandonngst
asked on
urgent : automatic start the apache web server
hi
i'm using apache as a web server in solaris. every time i reboot the server, i have to start the apache web server manually via a executable file which is located at /opt/apache/bin/httpd.
so, what command should i add to the profile file so when i reboot the server, the apache web server will start automatically.
thanks n best regards
brandon
i'm using apache as a web server in solaris. every time i reboot the server, i have to start the apache web server manually via a executable file which is located at /opt/apache/bin/httpd.
so, what command should i add to the profile file so when i reboot the server, the apache web server will start automatically.
thanks n best regards
brandon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
If you are using Solaris 8 then by default you get all the apache scripts in /etc/rc scripts. If you are not using Solaris 8, you may have to consider adding the following scripts. as mentioned by filliep in the /etc/rc locations.
/etc/init.d/apache
#!/sbin/sh
#
# Copyright (c) 1999 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "@(#)apache.sh 1.3 99/11/10 SMI"
#
# modified to change the configuration file locations - Krishna 08/28/01
#
APACHE_HOME={your apache home directory}
# example /opt/app/apache
CONF_FILE={your apache config directory}
# example /opt/app/apache/8080/httpd .conf
PIDFILE=/tmp/httpd.pid
if [ ! -f ${CONF_FILE} ]; then
exit 0
fi
case "$1" in
start)
/bin/rm -f ${PIDFILE}
cmdtext="starting"
/usr/apache/bin/httpd -f ${CONF_FILE}
;;
restart)
cmdtext="restarting"
status=`${APACHE_HOME}/bin /apachectl $1 2>&1`
;;
stop)
cmdtext="stopping"
status=`${APACHE_HOME}/bin /apachectl $1 2>&1`
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
echo "httpd $cmdtext."
-------------------
After copying the above script Then create softlinks as told by filliep.
post your comments here if you have any doubts.
Kidambi
If you are using Solaris 8 then by default you get all the apache scripts in /etc/rc scripts. If you are not using Solaris 8, you may have to consider adding the following scripts. as mentioned by filliep in the /etc/rc locations.
/etc/init.d/apache
#!/sbin/sh
#
# Copyright (c) 1999 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "@(#)apache.sh 1.3 99/11/10 SMI"
#
# modified to change the configuration file locations - Krishna 08/28/01
#
APACHE_HOME={your apache home directory}
# example /opt/app/apache
CONF_FILE={your apache config directory}
# example /opt/app/apache/8080/httpd
PIDFILE=/tmp/httpd.pid
if [ ! -f ${CONF_FILE} ]; then
exit 0
fi
case "$1" in
start)
/bin/rm -f ${PIDFILE}
cmdtext="starting"
/usr/apache/bin/httpd -f ${CONF_FILE}
;;
restart)
cmdtext="restarting"
status=`${APACHE_HOME}/bin
;;
stop)
cmdtext="stopping"
status=`${APACHE_HOME}/bin
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
echo "httpd $cmdtext."
-------------------
After copying the above script Then create softlinks as told by filliep.
post your comments here if you have any doubts.
Kidambi
brandonngst,
is the proposed solution working for you?
F.
is the proposed solution working for you?
F.
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:
- Answered by filiep
Please leave any comments here within the next 7 days
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
tfewster
Cleanup Volunteer
I will leave a recommendation for this question in the Cleanup topic area as follows:
- Answered by filiep
Please leave any comments here within the next 7 days
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
tfewster
Cleanup Volunteer
per recommendation
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
ln -s /etc/init.d/apachectl /etc/rc2.d/K99apache
If you leave run-level 3 (for a shutdown or going in single-user mode), apache will be proper closed.
If you manually want to start/stop apache, you can do it with /etc/init.d/apachectl start|stop
F.