diff options
Diffstat (limited to 'pki/base/ra/apache/apachectl')
-rwxr-xr-x | pki/base/ra/apache/apachectl | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/pki/base/ra/apache/apachectl b/pki/base/ra/apache/apachectl new file mode 100755 index 000000000..d5474740e --- /dev/null +++ b/pki/base/ra/apache/apachectl @@ -0,0 +1,184 @@ +#!/bin/sh +# +# --- BEGIN COPYRIGHT BLOCK --- +# +# Copyright 2000-2004 The Apache Software Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +# Initialize environment variables +LD_LIBRARY_PATH=[SYSTEM_USER_LIBRARIES]:[SYSTEM_LIBRARIES]:${LD_LIBRARY_PATH} +LD_LIBRARY_PATH=[SECURITY_LIBRARIES]:${LD_LIBRARY_PATH} +export LD_LIBRARY_PATH + +# see if httpd is linked with the openldap libraries - we need to override them +OS=`pkiname` +if [ $OS = "Linux" ]; then + hasopenldap=0 + + /usr/bin/ldd $httpd 2>&1 | grep libldap- > /dev/null 2>&1 && hasopenldap=1 + + if [ $hasopenldap -eq 1 ] ; then + LD_PRELOAD="[SYSTEM_USER_LIBRARIES]/libldap50.so" + LD_PRELOAD="[SYSTEM_USER_LIBRARIES]/dirsec/libssl3.so ${LD_PRELOAD}" + export LD_PRELOAD + fi +fi + +# +# Apache control script designed to allow an easy command line interface +# to controlling Apache. Written by Marc Slemko, 1997/08/23 +# +# The exit codes returned are: +# XXX this doc is no longer correct now that the interesting +# XXX functions are handled by [INSTANCE_ID] +# 0 - operation completed successfully +# 1 - +# 2 - usage error +# 3 - [INSTANCE_ID] could not be started +# 4 - [INSTANCE_ID] could not be stopped +# 5 - [INSTANCE_ID] could not be started during a restart +# 6 - [INSTANCE_ID] could not be restarted during a restart +# 7 - [INSTANCE_ID] could not be restarted during a graceful restart +# 8 - configuration syntax error +# +# When multiple arguments are given, only the error from the _last_ +# one is reported. Run "apachectl help" for usage info +# +ARGV="$@" +# +# |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| +# -------------------- -------------------- +# + +# +# a command that outputs a formatted text version of the HTML at the +# url given on the command line. Designed for lynx, however other +# programs may work. +if [ -x /usr/bin/links ]; then + LYNX="links -dump" +elif [ -x /usr/bin/lynx ]; then + LYNX="lynx -dump" +else + LYNX="none" +fi + +# +# the URL to your server's mod_status status page. If you do not +# have one, then status and fullstatus will not work. +STATUSURL="http://localhost:80/server-status" +# +# Set this variable to a command that increases the maximum +# number of file descriptors allowed per child process. This is +# critical for configurations that use many file descriptors, +# such as mass vhosting, or a multithreaded server. +ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`" + +######################################################################## +# This section contains modified content of "/etc/sysconfig/httpd" # +######################################################################## +# Configuration file for the [INSTANCE_ID] service. + +# +# The default processing model (MPM) is the process-based +# 'prefork' model. A thread-based model, 'worker', is also +# available, but does not work with some modules (such as PHP). +# The service must be stopped before changing this variable. +# +HTTPD=/opt/fortitude/sbin/httpd.worker + +# +# To pass additional options (for instance, -D definitions) to the +# httpd binary at startup, set OPTIONS here. +# +OPTIONS="-f [HTTPD_CONF]" + +# +# By default, the httpd process is started in the C locale; to +# change the locale in which the server runs, the HTTPD_LANG +# variable can be set. +# +HTTPD_LANG=C +######################################################################## +# # +######################################################################## + +# Set the maximum number of file descriptors allowed per child process. +if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then + $ULIMIT_MAX_FILES +fi + +ERROR=0 +if [ "x$ARGV" = "x" ] ; then + ARGV="-h" +fi + +function checklynx() { +if [ "$LYNX" = "none" ]; then + echo "The 'links' package is required for this functionality." + exit 8 +fi +} + +function testconfig() { +# [INSTANCE_ID] is denied terminal access in SELinux, so run in the +# current context to get stdout from $HTTPD -t. +if test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled; then + runcon -- `id -Z` $HTTPD $OPTIONS -t +else + $HTTPD $OPTIONS -t +fi +ERROR=$? +} + +case $ARGV in +restart|graceful) + if $HTTPD -t >&/dev/null; then + $HTTPD $OPTIONS -k $ARGV + ERROR=$? + else + echo "apachectl: Configuration syntax error, will not run \"$ARGV\":" + testconfig + fi + ;; +start|stop) + $HTTPD $OPTIONS -k $ARGV + ERROR=$? + ;; +startssl|sslstart|start-SSL) + $HTTPD $OPTIONS -DSSL -k start + ERROR=$? + ;; +configtest) + testconfig + ;; +status) + checklynx + $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } ' + ;; +fullstatus) + checklynx + $LYNX $STATUSURL + ;; +*) + $HTTPD $OPTIONS $ARGV + ERROR=$? +esac + +exit $ERROR + |