SYS_SED=sed
SYS_PS=ps
SYS_PIDOF=pidof
-SYS_APACHE=apache2
-SYS_APACHECTL=apache2ctl
+if test -f /usr/sbin/apache2; then
+ SYS_APACHE=apache2
+else
+ SYS_APACHE=httpd
+fi
+if test -f /usr/sbin/apache2ctl; then
+ SYS_APACHECTL=apache2ctl
+else
+ SYS_APACHECTL=apachectl
+fi
SYS_PING=ping
SYS_AWK=awk
SYS_ECHO=echo
return $TEST_ERROR
fi
- pid=`lsof -F p -i TCP:$req_port | sed "s/^p//"`
- if [ -z $pid ]; then
+ pid=`lsof -F p -i TCP:$req_port | sed "s/^p//" | head -n 1`
+ if [ -z "$pid" ]; then
return $TEST_ERROR
fi
program=`ps -p ${pid} -o args= | grep -E "[\/]*$req_program[ \t]*"`
echo " -t | --text Format output as plain ASCII text."
echo " -c | --color Format output as text with ANSI colours (autodetected by default)."
echo " -x | --html Format output as html."
+ echo " -f | --config Apache config file."
}
# read common definitions and functions
"-t" | "--text") setOutputASCII ;;
"-c" | "--color") setOutputColor ;;
"-x" | "--html") setOutputHTML ;;
+ "-f" | "--config") shift; apache_config_arg="-f $1" ;;
esac
shift
done
# check_binaries
printf "Testing if all binaries are available"
-check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_PIDOF
+check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_PIDOF $SYS_APACHECTL
if [ $? -gt 0 ]; then
test_failed
else
# GridSite module loaded:
printf "Testing if GridSite is loaded"
-${SYS_APACHECTL} -t -D DUMP_MODULES 2>&1| grep mod_gridsite >/dev/null 2>&1
+${SYS_APACHECTL} ${apache_config_arg} -t -D DUMP_MODULES 2>&1| grep gridsite_module >/dev/null 2>&1
if [ $? -eq 0 ]; then
- test done
+ test_done
else
test_failed
print_error "GridSite is not loaded in Apache"