apache2/find_mpm

48 lines
1.2 KiB
Bash

#!/bin/bash
: ${apache_link:=/usr/sbin/httpd2}
. /usr/share/apache2/load_configuration
if ! ${mpm_set:=false}; then
if [ -z "$APACHE_MPM" ]; then
# guess
for i in $r/$apache_link-*; do
test -f $i || continue
i=$(basename $i)
i=${i#*-}
installed_mpms=(${installed_mpms[*]} $i)
done
if [ -z "${installed_mpms[*]}" ]; then
echo >&2 ${warn}Apache binary ${apache_link#*-} not found. No MPM package installed? $norm
echo >&2 Hint: install the apache2-prefork package, and try again.
fi
if [ ${#installed_mpms[*]} = 1 ]; then
APACHE_MPM=${installed_mpms[*]}
else
case ${installed_mpms[*]} in
*prefork*) APACHE_MPM=prefork;;
*worker*) APACHE_MPM=worker;;
*event*) APACHE_MPM=event;;
*leader*) APACHE_MPM=leader;;
*metuxmpm*) APACHE_MPM=metuxmpm;;
*threadpool*) APACHE_MPM=threadpool;;
*itk*) APACHE_MPM=itk;;
esac
fi
fi
if [ -x $apache_link-$APACHE_MPM ]; then
ln -sf $apache_link-$APACHE_MPM $apache_link
echo $apache_link-$APACHE_MPM
else
echo >&2 ${warn}$apache_link-$APACHE_MPM is not a valid httpd2 binary.
echo >&2 Check your APACHE_MPM setting.$norm
exit 1
fi
export APACHE_MPM mpm_set=true
fi