Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-20 07:59:01

0001 #!/bin/sh
0002 #
0003 # chkconfig: - 85 15
0004 #
0005 # description: Panda server webserver
0006 # processname: httpd
0007 # config: /etc/panda/panda_server-httpd.conf
0008 # config: /etc/sysconfig/httpd-pandasrv
0009 # pidfile: /var/run/httpd-pandasrv.pid
0010 #
0011 # Copyright 2000-2004 The Apache Software Foundation
0012 #
0013 # Licensed under the Apache License, Version 2.0 (the "License");
0014 # you may not use this file except in compliance with the License.
0015 # You may obtain a copy of the License at
0016 #
0017 #     http://www.apache.org/licenses/LICENSE-2.0
0018 #
0019 # Unless required by applicable law or agreed to in writing, software
0020 # distributed under the License is distributed on an "AS IS" BASIS,
0021 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0022 # See the License for the specific language governing permissions and
0023 # limitations under the License.
0024 #
0025 #
0026 # Apache control script designed to allow an easy command line interface
0027 # to controlling Apache.  Written by Marc Slemko, 1997/08/23
0028 # 
0029 # The exit codes returned are:
0030 #   XXX this doc is no longer correct now that the interesting
0031 #   XXX functions are handled by httpd
0032 #       0 - operation completed successfully
0033 #       1 - 
0034 #       2 - usage error
0035 #       3 - httpd could not be started
0036 #       4 - httpd could not be stopped
0037 #       5 - httpd could not be started during a restart
0038 #       6 - httpd could not be restarted during a restart
0039 #       7 - httpd could not be restarted during a graceful restart
0040 #       8 - configuration syntax error
0041 #
0042 # When multiple arguments are given, only the error from the _last_
0043 # one is reported.  Run "apachectl help" for usage info
0044 #
0045 ARGV="$@"
0046 #
0047 # |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
0048 # --------------------                              --------------------
0049 # 
0050 # the path to your httpd binary, including options if necessary
0051 HTTPD='/usr/sbin/httpd'
0052 
0053 #
0054 # a command that outputs a formatted text version of the HTML at the
0055 # url given on the command line.  Designed for lynx, however other
0056 # programs may work.  
0057 if [ -x /usr/bin/links ]; then
0058    LYNX="links -dump"
0059 elif [ -x /usr/bin/lynx ]; then
0060    LYNX="lynx -dump"
0061 else
0062    LYNX="none"
0063 fi
0064 
0065 # go into virtual env
0066 VIRTUAL_ENV=/FIXME
0067 . ${VIRTUAL_ENV}/bin/activate
0068 
0069 #
0070 # the URL to your server's mod_status status page.  If you do not
0071 # have one, then status and fullstatus will not work.
0072 STATUSURL="http://localhost:25080/server-status"
0073 
0074 # Source /etc/sysconfig/httpd for $HTTPD setting, etc.
0075 if [ -r ${VIRTUAL_ENV}/etc/sysconfig/panda_harvester ]; then
0076    . ${VIRTUAL_ENV}/etc/sysconfig/panda_harvester
0077 fi
0078 
0079 ERROR=0
0080 if [ "x$ARGV" = "x" ] ; then 
0081     ARGV="-h"
0082 fi
0083 
0084 function check13() {
0085 # check for 1.3 configuration
0086 GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
0087 GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
0088 GONE="${GONE}AccessConfig|ResourceConfig)"
0089 if grep -Eiq "^[[:space:]]*($GONE)" /etc/httpd/conf/httpd.conf; then
0090   echo "$0: Apache 1.3 configuration directives found"
0091   echo "$0: please read /usr/share/doc/httpd-2.0.52/migration.html"
0092   exit 2
0093 fi
0094 }
0095 
0096 function checklynx() {
0097 if [ "$LYNX" = "none" ]; then
0098    echo "The 'links' package is required for this functionality."
0099    exit 8
0100 fi
0101 }
0102 
0103 function testconfig() {
0104 # httpd is denied terminal access in SELinux, so run in the
0105 # current context to get stdout from $HTTPD -t.
0106 if test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled; then
0107   runcon -- `id -Z` $HTTPD $OPTIONS -t
0108 else
0109   $HTTPD $OPTIONS -t
0110 fi
0111 ERROR=$?
0112 }
0113 
0114 function check_pidfile () {
0115     if [ -r ${VIRTUAL_ENV}/var/log/panda/panda_harvester_httpd.pid ]; then
0116         COMSTR=`echo $HTTPD $OPTIONS -k $ARGV`
0117         COMSTR=`echo $COMSTR | sed -e 's/ //g'`
0118         PSOUT=`ps -f -p \`cat ${VIRTUAL_ENV}/var/log/panda/panda_harvester_httpd.pid\` | cat | tail -1`
0119         PSOUT=`echo $PSOUT | sed -e 's/ //g'`
0120         if [ ! `echo $PSOUT | grep $COMSTR` ]; then
0121             echo "deleting pid"
0122             rm -rf ${VIRTUAL_ENV}/var/log/panda/panda_harvester_httpd.pid
0123         fi
0124     fi
0125 }
0126 
0127 case $ARGV in
0128 restart|graceful)
0129     if $HTTPD -t >&/dev/null; then
0130        $HTTPD $OPTIONS -k $ARGV
0131        ERROR=$?
0132     else
0133        echo "apachectl: Configuration syntax error, will not run \"$ARGV\":"
0134        testconfig
0135     fi
0136     ;;
0137 start|stop)
0138     check13
0139     case $ARGV in
0140         start)
0141             check_pidfile
0142     esac
0143     $HTTPD $OPTIONS -k $ARGV
0144     ERROR=$?
0145     ;;
0146 startssl|sslstart|start-SSL)
0147     check13
0148     $HTTPD $OPTIONS -DSSL -k start
0149     ERROR=$?
0150     ;;
0151 configtest)
0152     testconfig
0153     ;;
0154 status)
0155     checklynx
0156     $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
0157     ;;
0158 fullstatus)
0159     checklynx
0160     $LYNX $STATUSURL
0161     ;;
0162 *)
0163     $HTTPD $OPTIONS $ARGV
0164     ERROR=$?
0165 esac
0166 
0167 exit $ERROR
0168