#!/bin/sh

set -e

[ -s conf ] && . ./conf

mkdir -p /run/httpd
chmod 0710 /run/httpd
chown root:_apache /run/httpd

: ${ROOTDIR:=/srv/www/apache}
: ${LOGDIR:=/var/log/httpd}

if [ ! -d $ROOTDIR ]; then
	mkdir -p $ROOTDIR
	chown _apache:_apache $ROOTDIR
fi
if [ ! -d $LOGDIR ]; then
	mkdir -p $LOGDIR
	chown _apache:_apache $LOGDIR
fi

exec httpd -DNO_DETACH
