LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Removing apache 1.3.19 after upgrade (https://www.linuxquestions.org/questions/linux-networking-3/removing-apache-1-3-19-after-upgrade-32328/)

GabeF 10-09-2002 09:49 AM

Removing apache 1.3.19 after upgrade
 
Now that I have upgraded to apache2, the conf files and httpd are in /usr/local/apache2. The old files, /etc/rc.d/init.d/httpd and /etc/httpd/conf/httpd.conf and all that good stuff still reside on my machine, but as far as I can tell are not being used. Linux, though still wants to start the old httpd. Should I delete all the the old files or is there a way to relink to the new ones?

Mara 10-09-2002 12:28 PM

You can edit the old script to run your new apache at boot. Or, if you have a new script written, you can delete all old ones.

GabeF 10-09-2002 01:32 PM

So all I have to do is change the references to httpd in the old script to the new directory? Thanks for your help.

Mara 10-09-2002 01:50 PM

Exactly, you only need to change pathes inside script files.

GabeF 10-09-2002 02:10 PM

In /etc/rc5.d/init.d/httpd, I changed all occurances of /usr/sbin/httpd to /usr/local/apache2/bin/httpd and when I tried to start it, I got the message:

Starting httpd: execvp: No such file or directory

I didn't change the path to httpd-perl.conf because there was no new one. Could that cause the problem?

Mara 10-09-2002 04:24 PM

Could you post your script? It's hard to say without seeing it.

GabeF 10-09-2002 05:40 PM

Ok. Here is the script before I made any changes to it:

Code:

#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 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: /etc/httpd/conf/httpd.conf

# Source function library.
. /etc/rc.d/init.d/functions

unset LS_COLORS KDE_DISPLAY BROWSER HELP_BROWSER GTK_RC_FILES XMODIFIERS
unset COLORTERM DISPLAY LOGNAME SESSION_MANAGER KDE_INITIAL_DESKTOP
unset TERM HOME USERNAME PWD ENV USER

### Hack for Status
LYNX="lynx -dump"
STATUSURL="http://localhost:81/server-status"
STATUSURLPERL="http://localhost:8200/server-status"

# Change the major functions into functions.
moduleargs() {
        moduledir=/usr/lib/apache
        moduleargs=
        for module in ${moduledir}/*.so ; do
                if [ -x ${module} ] ; then
                        module=`echo ${module} | awk '{\
                                gsub(".*/","");\
                                gsub("^mod_","");\
                                gsub("^lib","");\
                                gsub("\.so$","");\
                                print toupper($0)}'`
                        moduleargs="${moduleargs} -DHAVE_$module"
                fi
        done
        echo ${moduleargs}
}

# Get the extra modules so only the main server gets them
extramoduleargs() {
        extramoduledir=/usr/lib/apache-extramodules
        extramoduleargs=
        for extramodule in ${extramoduledir}/*.so ; do
                if [ -x ${extramodule} ] ; then
                        extramodule=`echo ${extramodule} | awk '{\
                                gsub(".*/","");\
                                gsub("^mod_","");\
                                gsub("^lib","");\
                                gsub("\.so$","");\
                                print toupper($0)}'`
                        extramoduleargs="${extramoduleargs} -DHAVE_$extramodule"
                fi
        done
        echo ${extramoduleargs}
}

### Hacks for the apache + proxified apache-mod_perl
# Assign all extra modules to both servers first
APACHEXMODS=`extramoduleargs`
PERLXMODS=`extramoduleargs`
COMMONMODS=`moduleargs`
       
#If both servers are installed, perl runs as a proxy
#and has no extra modules
if [ -x /usr/sbin/httpd -a -x /usr/sbin/httpd-perl ]; then
        DEFINE="-DPERLPROXIED"
        PERLXMODS=""
fi
PERLFILE="-f /etc/httpd/conf/httpd-perl.conf"
###

## Hack for ApacheJServ that takes forever to shut down and restart
snooze() {
        for count in 1 2 3 4 5 6 7 8 9 ; do echo -n "."; sleep 1; done
        echo
}

conftest() {
        badconf=0
        if [ -x /usr/sbin/httpd ]; then
                action "Checking configuration sanity for httpd: " \
                        /usr/sbin/httpd -t \
                        $DEFINE $APACHEXMODS $COMMONMODS
                badconf=$?
        fi
        if [ -x /usr/sbin/httpd-perl ]; then
                action "Checking configuration sanity for httpd-perl: " \
                        /usr/sbin/httpd-perl -t \
                        $PERLFILE $DEFINE $PERLXMODS $COMMONMODS
                [ $badconf = 0 ] && badconf=$?
        fi
        return $badconf
}

start() {
        for tries in 1 2 3; do
          if [ -x /usr/sbin/httpd-perl -a ! -e /var/run/httpd-perl.pid ]; then
                if [ $tries -eq 1 ]; then echo -n "Starting httpd-perl: ";fi
                daemon httpd-perl $PERLFILE $DEFINE $PERLXMODS $COMMONMODS
                echo
                for wait in 1 2 3 4 5;do
                        if [ ! -e /var/run/httpd-perl.pid ]; then sleep 1;fi
                done
          fi
          if [ -x /usr/sbin/httpd -a ! -e /var/run/httpd.pid ]; then
                if [ $tries -eq 1 ]; then echo -n "Starting httpd: ";fi
                daemon httpd $DEFINE $APACHEXMODS $COMMONMODS
                echo
                for wait in 1 2 3 4 5;do
                        if [ ! -e /var/run/httpd.pid ]; then sleep 1;fi
                done
          fi
        done
        touch /var/lock/subsys/httpd
}

stop() {
        if [ -x /usr/sbin/httpd-perl -a -e /var/run/httpd-perl.pid ]; then
                echo -n "Shutting down httpd-perl: "
                killproc httpd-perl
                echo
                rm -f /var/run/httpd-perl.pid
        fi
        if [ -x /usr/sbin/httpd  -a -e /var/run/httpd.pid ]; then
                echo -n "Shutting down httpd: "
                killproc httpd
                echo
                if [ -e /usr/lib/apache-extramodules/mod_jserv.so ]; then
                        snooze
                        while [ -e /var/run/httpd.pid ]; do
                                echo Trying harder
                                snooze
                                killproc httpd
                        done
                fi
                rm -f /var/run/httpd.pid
        fi
        rm -f /var/lock/subsys/httpd
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  extendedstatus)
        $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '       
        echo
        echo -n "#######################################"
        echo    "#######################################"
        if [ -x /usr/sbin/httpd -a -x /usr/sbin/httpd-perl ]; then
          $LYNX $STATUSURLPERL | awk ' /process$/ { print; exit } { print } '       
          echo
          echo -n "#######################################"
          echo    "#######################################"
        fi
        ;;
  status)
        echo
        if [ -e /var/run/httpd.pid ]; then
                echo "Apache is running."
                echo "httpd: `pidof httpd`"
                echo
        fi
        if [ -e /var/run/httpd-perl.pid ]; then
                echo "Apache-mod_perl is running."
                echo "httpd-perl: `pidof httpd-perl`"
                echo
        fi
        if [ ! -e /var/run/httpd.pid -a ! -e /var/run/httpd-perl.pid ]; then       
                echo "Apache is *not* running."
                echo
        fi
        echo "Use $0 extendedstatus for more information."
        echo
        ;;
  restart)
        stop
        start
        ;;
  update|condrestart)
        if [ -e /var/run/httpd.pid -o -e /var/run/httpd-perl.pid ]; then
                stop
                conftest || exit $?
                start
        fi
        ;;
  reload|graceful)
        if [ -e /usr/lib/apache-extramodules/mod_jserv.so ]; then
                stop
                start
        else
                if [ -x /usr/sbin/httpd -a -e /var/run/httpd-perl.pid ]; then
                        echo -n "Reloading httpd-perl: "
                        killproc httpd -USR1
                        echo
                fi
                if [ -x /usr/sbin/httpd -a -e /var/run/httpd.pid ]; then
                        echo -n "Reloading httpd: "
                        killproc httpd -USR1
                        echo
                fi
        fi
        ;;
  configtest)
        conftest
        exit $?
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|reload/graceful|update|status|configtest}"
        exit 1
esac

exit 0

Thanks for taking the time to go over this :)

GabeF 10-14-2002 08:02 AM

Did apache2 get rid of httpd-perl? I didn't see any new version to change the directory to in the script. I tried changing all occurances of /var/run/httpd.pid and /usr/sbin/httpd to the new directory but it gives me that execvp error.

Mara 10-14-2002 03:35 PM

It's enough to have much smaller script. In fact, all you need to have is
/usr/local/apache2/bin/apachectl start
to start your Apache and
/usr/local/apache2/bin/apachectl stop
to stop it. In my installation (I don't remember correctly, but I think so) there's no perl, o httpd-perl does not exist. I suppose it's similar with yours.

GabeF 10-14-2002 07:52 PM

Well thank you very much for your help.


All times are GMT -5. The time now is 02:36 PM.