#! /bin/sh
#
# Read /etc/cern-httpd and try to determine if the 
# server is running standalone or from inetd.
#
# Can be used in the construct
#
# if /usr/lib/cern-httpd/test_standalone ; then
#   echo "standalone"
# else
#   echo "inetd"
# fi
#
# The sed commands removes the comments, the greps look for a Port
# command or "Servertype standalone".
#
CFGFILE=/etc/cern-httpd.conf
sed -e 's/#.*//' $CFGFILE | grep -Eqi '^[^#]*\W*port\W+[[:digit:]]+' \
|| sed -e 's/#.*//' $CFGFILE | grep -Eqi '^\W*servertype\W+standalone+' \
 && exit 0
#
# greps failed
#
exit 1
