#!/bin/sh # # @(#) rc.httpd v1.3.3 - Copyright (C) 27.5.99 by Andreas Ley # # WARNING: Changing this script in any way may lead to a system that # is unbootable. Do not modify this script. # # Purpose: # Start or stop the apache httpd or reload its configuration # # Mandatory arguments: # start : start up apache httpd # stop : stop apache httpd # start_msg : only print message indicating what 'start' action does # stop_msg : only print message indicating what 'stop' action does # # Optional arguments: # reload : reload apache httpd configuration # reload_msg : only print message indicating what 'reload' action does # # Return values: # 0 = success; causes "OK" to show up in checklist. # 1 = failure; causes "FAIL" to show up in checklist. # 2 = skip; causes "N/A" to show up in the checklist. # Use this value if execution of this script is overridden # by the use of a control variable, or if this script is not # appropriate to execute for some other reason. # 3 = reboot; causes the system to be rebooted after execution. # You will not need to use this value! # # Input and output: # stdin is redirected from /dev/null # # stdout and stderr are redirected to the /etc/rc.log file # during checklist mode, or to the console in raw mode. # # WARNING: If this script (or any other startup script) executes in run state 0 # or state 1, then /usr might not be available. Do not attempt to access # commands or files in /usr unless it executes in run state 2 or greater. # Other file systems typically not mounted until run state 2 include /var # and /opt. # ############################################################################### # # The following configuration variables can be defined in file # /etc/rc.values or /etc/rc.config.d/httpd # # $HTTPD_START: # "" Start apache httpd # "0" Skip (Don't start apache httpd) # "1" Start apache httpd # # $HTTPD_OPTIONS: # These options are passed directly to the apache http daemon. # ############################################################################### PATH=/usr/sbin:/usr/bin:/sbin:/bin export PATH # Oracle is too dumb to know where it is even if it was originally installed, # dynamically linked and just loaded from this exact point :( ORACLE_HOME=/usr/segment/oracle/8.1.6 export ORACLE_HOME SERVERROOT=/usr/local/etc/httpd # Absolute path to server root. HTTPD=${SERVERROOT}/bin/httpd # Absolute path to apache http daemon. PIDFILE=${SERVERROOT}/logs/httpd.pid # Absolute path to httpd pid file. LOOPPIDFILE=${SERVERROOT}/logs/loop.pid # Absolute path to httpd pid file. CONFFILE=${SERVERROOT}/conf/srm.conf # Absolute path to httpd config file. retval=0 set_return() { exitcode=$? if [ ${exitcode} -ne 0 ]; then echo "EXIT CODE: ${exitcode}" retval=1 fi return ${exitcode} } case $1 in start_msg) echo "Start apache httpd" ;; start) if [ -f /etc/TIMEZONE ] ; then . /etc/TIMEZONE fi if [ -f /etc/rc.config.d/httpd ] ; then . /etc/rc.config.d/httpd fi if [ -f /etc/rc.values -a -x /sbin/shstrings ] ; then eval `/sbin/shstrings -f /etc/rc.values HTTPD_START HTTPD_OPTIONS` fi if cd ${SERVERROOT} >/dev/null; then if [ -d conf/vhost -a -x bin/vhost_setup ]; then if bin/vhost_setup; then echo "Virtual interfaces configured" else echo "Unable to configure virtual interfaces" retval=1 fi fi if test -s conf/server.key -a -s conf/server.crt; then HTTPD_OPTIONS="${HTTPD_OPTIONS} -DSSL -DSSL_SERVERKEY" elif test -s /etc/ssl/host.key -a -s /etc/ssl/host.crt; then HTTPD_OPTIONS="${HTTPD_OPTIONS} -DSSL" fi if [ ${HTTPD_START:-1} -ne 0 -a -x ${HTTPD} ]; then /usr/machine/bin/loop -d -x ${LOOPPIDFILE} ${HTTPD} -F ${HTTPD_OPTIONS} if set_return; then echo "httpd started" else echo "Unable to start httpd" fi else retval=2 fi else retval=2 fi ;; stop_msg) echo "Stop apache httpd" ;; stop) if [ -s ${LOOPPIDFILE} -o -s ${PIDFILE} ]; then if kill `cat ${LOOPPIDFILE} ${PIDFILE} 2>/dev/null`; then echo "httpd stopped" else echo "Unable to stop httpd" retval=1 fi else retval=2 fi ;; reload_msg) echo "Reload apache httpd configuration" ;; reload) if [ -d ${SERVERROOT}/conf/vhost -a -x ${SERVERROOT}/bin/vhost_setup ]; then if ${SERVERROOT}/bin/vhost_setup; then echo "Virtual interfaces configuration reloaded" else echo "Unable to reload virtual interfaces configuration" retval=1 fi fi if [ -s ${PIDFILE} ]; then if kill -USR1 `cat ${PIDFILE}`; then echo "httpd configuration reloaded" else echo "Unable to reload httpd configuration" retval=1 fi else retval=2 fi ;; *) echo "Usage: $0 {start|stop|reload|start_msg|stop_msg|reload_msg}" retval=1 ;; esac exit ${retval}