#! /bin/sh

log() {
    LINE="$(date +"%FT%T") $@"
    echo $LINE >> /var/log/apache2/apache2.log
}

log "Stopping apache2"

OUT=$(/bin/pgrep -f 'httpd -k start' | /usr/bin/xargs /bin/kill -9)
if [ $? -ne 0 ]; then
    log "Failed to stop apache:"
    log "$OUT"
fi
