diff options
author | clement <clement@FreeBSD.org> | 2005-06-02 01:47:53 +0800 |
---|---|---|
committer | clement <clement@FreeBSD.org> | 2005-06-02 01:47:53 +0800 |
commit | ad2e6122b30aff71069858b3192ee89548a447fb (patch) | |
tree | 1308d552eddc9fc8c901a77d8915cebfbc071e2b | |
parent | 5951f30223a24cef404a44453042a58de0d0d88e (diff) | |
download | freebsd-ports-gnome-ad2e6122b30aff71069858b3192ee89548a447fb.tar.gz freebsd-ports-gnome-ad2e6122b30aff71069858b3192ee89548a447fb.tar.zst freebsd-ports-gnome-ad2e6122b30aff71069858b3192ee89548a447fb.zip |
- Add support for multiple instances of apache2 to startup script.
It's a little bit experimental, but it works.
-rw-r--r-- | www/apache2/files/apache.sh | 58 | ||||
-rw-r--r-- | www/apache20/files/apache.sh | 58 |
2 files changed, 102 insertions, 14 deletions
diff --git a/www/apache2/files/apache.sh b/www/apache2/files/apache.sh index e3e6d6611af7..b3f1ea7d9d91 100644 --- a/www/apache2/files/apache.sh +++ b/www/apache2/files/apache.sh @@ -12,6 +12,7 @@ # Add the following lines to /etc/rc.conf to enable apache2: # apache2_enable (bool): Set to "NO" by default. # Set it to "YES" to enable apache2 +# apache2_profiles (string): Undefined by default. Define here your profiles. # apache2ssl_enable (bool): Set to "NO" by default. # Set it to "YES" to start apache with SSL # (if <IfDefined SSL> exists in httpd.conf) @@ -23,6 +24,7 @@ # apache2limits_args (str): Default to "-e -C daemon" # Arguments of pre-start limits run. # + . %%RC_SUBR%% name="apache2" @@ -32,20 +34,62 @@ start_precmd="apache2_precmd" restart_precmd="apache2_checkconfig" reload_precmd="apache2_checkconfig" command="%%PREFIX%%/sbin/httpd" -pidfile="/var/run/httpd.pid" +_pidprefix="/var/run/httpd" +pidfile="${_pidprefix}.pid" required_files=%%PREFIX%%/etc/apache2/httpd.conf -[ -z "$apache2_enable" ] && apache2_enable="NO" -[ -z "$apache2ssl_enable" ] && apache2ssl_enable="NO" -[ -z "$apache2_flags" ] && apache2_flags="" -[ -z "$apache2limits_enable" ] && apache2limits_enable="NO" -[ -z "$apache2limits_args" ] && apache2limits_args="-e -C daemon" +[ -z "${apache2_enable}" ] && apache2_enable="NO" +[ -z "${apache2ssl_enable}" ] && apache2ssl_enable="NO" +[ -z "${apache2_flags}" ] && apache2_flags="" +[ -z "${apache2limits_enable}" ] && apache2limits_enable="NO" +[ -z "${apache2limits_args}" ] && apache2limits_args="-e -C daemon" +[ -z "${apache2_configfile}" ] && apache2_configfile="" load_rc_config $name +if [ -n "${2}" ]; then + profile=${2} + if [ "x${apache2_profiles}" != "x" ]; then + pidfile="${_pidprefix}.${profile}.pid" + eval apache2_configfile=\${apache2_${profile}_configfile} + [ "x${apache2_configfile}" = "x" ] && { + echo "You must define a configuration file (apache2_${profile}_configfile)" + exit 1 + } + eval apache2_enable=\${apache2_${profile}_enable:-YES} + eval apache2ssl_enable=\${apache2ssl_${profile}_enable:-NO} + eval apache2_flags=\${apache2_${profile}_flags:-${apache2_flags}} + eval apache2limits_enable=\${apache2limits_${profile}_enable:-${apache2limits_enable}} + eval apache2limits_args=\${apache2limits_${profile}_args:-${apache2limits_args}} + pidfile="${_pidprefix}.${profile}.pid" + apache2_flags="-c \"PidFile ${pidfile}\" ${apache2_flags}" + else + echo "$0: extra argument ignored" + fi +else + if [ "x${apache2_profiles}" != "x" ]; then + for profile in ${apache2_profiles}; do + echo "===> apache2 profile: ${profile}" + $0 $1 $profile + retcode=$? + if [ "$?" -ne 0 ]; then + failed="${profile} ({$retcode}) ${failed}" + else + success="${profile} ${success}" + fi + done + exit 0 + fi +fi + checkyesno apache2ssl_enable && \ apache2_flags="-DSSL $apache2_flags" +[ "x${apache2_configfile}" != "x" ] && { + apache2_flags="-f ${apache2_configfile} ${apache2_flags}" + required_files=${apache2_configfile} +} + apache2_checkconfig() { echo "Performing sanity check on apache2 configuration:" @@ -64,7 +108,7 @@ apache2_precmd() else return 0 fi - + echo DEBUG ${apache2_flags} } sig_reload=SIGUSR1 diff --git a/www/apache20/files/apache.sh b/www/apache20/files/apache.sh index e3e6d6611af7..b3f1ea7d9d91 100644 --- a/www/apache20/files/apache.sh +++ b/www/apache20/files/apache.sh @@ -12,6 +12,7 @@ # Add the following lines to /etc/rc.conf to enable apache2: # apache2_enable (bool): Set to "NO" by default. # Set it to "YES" to enable apache2 +# apache2_profiles (string): Undefined by default. Define here your profiles. # apache2ssl_enable (bool): Set to "NO" by default. # Set it to "YES" to start apache with SSL # (if <IfDefined SSL> exists in httpd.conf) @@ -23,6 +24,7 @@ # apache2limits_args (str): Default to "-e -C daemon" # Arguments of pre-start limits run. # + . %%RC_SUBR%% name="apache2" @@ -32,20 +34,62 @@ start_precmd="apache2_precmd" restart_precmd="apache2_checkconfig" reload_precmd="apache2_checkconfig" command="%%PREFIX%%/sbin/httpd" -pidfile="/var/run/httpd.pid" +_pidprefix="/var/run/httpd" +pidfile="${_pidprefix}.pid" required_files=%%PREFIX%%/etc/apache2/httpd.conf -[ -z "$apache2_enable" ] && apache2_enable="NO" -[ -z "$apache2ssl_enable" ] && apache2ssl_enable="NO" -[ -z "$apache2_flags" ] && apache2_flags="" -[ -z "$apache2limits_enable" ] && apache2limits_enable="NO" -[ -z "$apache2limits_args" ] && apache2limits_args="-e -C daemon" +[ -z "${apache2_enable}" ] && apache2_enable="NO" +[ -z "${apache2ssl_enable}" ] && apache2ssl_enable="NO" +[ -z "${apache2_flags}" ] && apache2_flags="" +[ -z "${apache2limits_enable}" ] && apache2limits_enable="NO" +[ -z "${apache2limits_args}" ] && apache2limits_args="-e -C daemon" +[ -z "${apache2_configfile}" ] && apache2_configfile="" load_rc_config $name +if [ -n "${2}" ]; then + profile=${2} + if [ "x${apache2_profiles}" != "x" ]; then + pidfile="${_pidprefix}.${profile}.pid" + eval apache2_configfile=\${apache2_${profile}_configfile} + [ "x${apache2_configfile}" = "x" ] && { + echo "You must define a configuration file (apache2_${profile}_configfile)" + exit 1 + } + eval apache2_enable=\${apache2_${profile}_enable:-YES} + eval apache2ssl_enable=\${apache2ssl_${profile}_enable:-NO} + eval apache2_flags=\${apache2_${profile}_flags:-${apache2_flags}} + eval apache2limits_enable=\${apache2limits_${profile}_enable:-${apache2limits_enable}} + eval apache2limits_args=\${apache2limits_${profile}_args:-${apache2limits_args}} + pidfile="${_pidprefix}.${profile}.pid" + apache2_flags="-c \"PidFile ${pidfile}\" ${apache2_flags}" + else + echo "$0: extra argument ignored" + fi +else + if [ "x${apache2_profiles}" != "x" ]; then + for profile in ${apache2_profiles}; do + echo "===> apache2 profile: ${profile}" + $0 $1 $profile + retcode=$? + if [ "$?" -ne 0 ]; then + failed="${profile} ({$retcode}) ${failed}" + else + success="${profile} ${success}" + fi + done + exit 0 + fi +fi + checkyesno apache2ssl_enable && \ apache2_flags="-DSSL $apache2_flags" +[ "x${apache2_configfile}" != "x" ] && { + apache2_flags="-f ${apache2_configfile} ${apache2_flags}" + required_files=${apache2_configfile} +} + apache2_checkconfig() { echo "Performing sanity check on apache2 configuration:" @@ -64,7 +108,7 @@ apache2_precmd() else return 0 fi - + echo DEBUG ${apache2_flags} } sig_reload=SIGUSR1 |