You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by kr...@iNetwebz.com on 2003/03/03 16:50:55 UTC
[users@httpd] startup scripts
i'm using suse linux 8.0 and have a question about starting up apache. my
distro came with version 1.3.27, but i manually compiled and installed
version 2.0.44. i had them both running simultaneously for a while with
2.0.44 bound to port 8080, but i have since stopped running 1.3.27 and
restarted 2.0.44. bound to port 80.
without thinking about it, i moved /etc/init.d/apache to
/etc/init.d/apache.old and removed the S and K symlinks in rc3.d and rc5.d.
i know linux is never supposed to crash and that the servers are supposed to
run for years without interruption, but in the unlikely event that the
machine has to be booted or anything...can i just create a symlink using
"ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache"? (they're on
the same file system, so "-s" won't be a problem -- but for the sake of
scalability, should i omit it? or should i not link to apachectl at all?)
and when creating the symlinks in rc[3|5].d, what services should be started
and killed before apache? the sever is running a little bit of everything
(e.g. ssh, postfix, mysql, named, pro-ftp, etc.).
thanks,
kevin
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] startup scripts
Posted by Kevin Robert Casey <kr...@inetwebz.com>.
thanks for all the help -- it seems to be working just like it should.
kevin
-----Original Message-----
From: Jeremy Whitlock [mailto:jwhitlock@starprecision.com]
Sent: Tuesday, March 04, 2003 10:01 AM
To: users@httpd.apache.org
Subject: RE: [users@httpd] startup scripts
My startup script for a standalone installation of Apache. (Not the one
installed with any Linux OS) Here it is:
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Path to the apachectl script, server binary, and short-form for
messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
prog=httpd
RETVAL=0
# check for 1.3 configuration
check13 () {
CONFFILE=/usr/local/apache2/conf/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
echo 1>&2 " Apache 1.3 configuration directives found"
echo 1>&2 " please read
/usr/local/apache2/doc/httpd-2.0.40/migration.html"
failure "Apache 1.3 config directives test"
echo
exit 1
fi
}
# The semantics of these two functions differ from the way apachectl
does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init
scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
check13 || exit 1
daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
echo -n $"Reloading $prog: "
check13 || exit 1
killproc $httpd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog
{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|c
onfigtest}"
exit 1
esac
exit $RETVAL
This will give you the ability to control Apache fully either through
the command line or the Services Tool in the GUI. All you have to do it
change the path to apachectl and httpd. Hope this helps, Jeremy
-----Original Message-----
From: Richard Hector [mailto:rhector@paradise.net.nz]
Sent: Tuesday, March 04, 2003 1:17 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] startup scripts
On Mon, Mar 03, 2003 at 10:50:55AM -0500, krc@iNetwebz.com wrote:
> "ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache"? (they're
on
> the same file system, so "-s" won't be a problem -- but for the sake
of
> scalability, should i omit it? or should i not link to apachectl at
all?)
I think you may have things a little backwards here. ln -s creates a
symbolic link, which will work fine across different filesystems.
Leaving
it out will (attempt to) create a hard link, which won't. So leaving it
in
is what you want.
Richard
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] startup scripts
Posted by Jeremy Whitlock <jw...@starprecision.com>.
My startup script for a standalone installation of Apache. (Not the one
installed with any Linux OS) Here it is:
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Path to the apachectl script, server binary, and short-form for
messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
prog=httpd
RETVAL=0
# check for 1.3 configuration
check13 () {
CONFFILE=/usr/local/apache2/conf/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
echo 1>&2 " Apache 1.3 configuration directives found"
echo 1>&2 " please read
/usr/local/apache2/doc/httpd-2.0.40/migration.html"
failure "Apache 1.3 config directives test"
echo
exit 1
fi
}
# The semantics of these two functions differ from the way apachectl
does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init
scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
check13 || exit 1
daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
echo -n $"Reloading $prog: "
check13 || exit 1
killproc $httpd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog
{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|c
onfigtest}"
exit 1
esac
exit $RETVAL
This will give you the ability to control Apache fully either through
the command line or the Services Tool in the GUI. All you have to do it
change the path to apachectl and httpd. Hope this helps, Jeremy
-----Original Message-----
From: Richard Hector [mailto:rhector@paradise.net.nz]
Sent: Tuesday, March 04, 2003 1:17 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] startup scripts
On Mon, Mar 03, 2003 at 10:50:55AM -0500, krc@iNetwebz.com wrote:
> "ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache"? (they're
on
> the same file system, so "-s" won't be a problem -- but for the sake
of
> scalability, should i omit it? or should i not link to apachectl at
all?)
I think you may have things a little backwards here. ln -s creates a
symbolic link, which will work fine across different filesystems.
Leaving
it out will (attempt to) create a hard link, which won't. So leaving it
in
is what you want.
Richard
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] startup scripts
Posted by Richard Hector <rh...@paradise.net.nz>.
On Mon, Mar 03, 2003 at 10:50:55AM -0500, krc@iNetwebz.com wrote:
> "ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache"? (they're on
> the same file system, so "-s" won't be a problem -- but for the sake of
> scalability, should i omit it? or should i not link to apachectl at all?)
I think you may have things a little backwards here. ln -s creates a
symbolic link, which will work fine across different filesystems. Leaving
it out will (attempt to) create a hard link, which won't. So leaving it in
is what you want.
Richard
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] startup scripts
Posted by Joshua Slive <jo...@slive.ca>.
On Mon, 3 Mar 2003 krc@iNetwebz.com wrote:
> machine has to be booted or anything...can i just create a symlink using
> "ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache"?
In general, yes, this should work fine. I don't know the exact
requirements of your version of Linux, but apachectl is designed to work
as an init script.
> and when creating the symlinks in rc[3|5].d, what services should be started
> and killed before apache? the sever is running a little bit of everything
> (e.g. ssh, postfix, mysql, named, pro-ftp, etc.).
Apache requires only basic networking services, and possible the resolver
(named).
Of course, you shouldn't just configure this and forget it. You should
test it (perhaps reboot during off hours) to make sure everything works
correctly.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org