#!/usr/share/ucs-test/runner bash
# shellcheck shell=bash
## desc: Check if apache is usable after a reload
## tags: [apptest]
## bugs: [37792]
## exposure: dangerous

ret=0

/etc/init.d/apache2 reload

if ! timeout 5 apachectl status; then
	ret=1
fi

if ! timeout 5 www-browser -dump http://localhost:80/server-status; then
	ret=1
fi

if [ $ret != 0 ]; then
	pkill -9 -f '/usr/sbin/apache2 -k'
	/etc/init.d/apache2 restart
fi

exit $ret
# vim: set ft=sh :
