#!/usr/bin/bash

if [[ -e /etc/httpd/enable.reload.by.cronjob || -e /etc/httpd/debug.reload.by.cronjob ]]; then
	COM_STR=`/usr/bin/ps -o command --pid $PPID --no-headers`
	/usr/bin/logger "httpd-reload started by PID: $PPID COMMAND: '$COM_STR'"
fi

if [[ -e /etc/httpd/enable.reload.by.cronjob ]]; then
	/usr/bin/touch /run/httpd/need.reload
	/usr/bin/logger "httpd-reload created /run/httpd/need.reload"
elif [[ -n "$*" ]]; then
	if [[ -e /etc/httpd/debug.reload.by.cronjob ]]; then
		/usr/bin/logger "httpd-reload running '$*'"
	fi
	/usr/bin/bash -c "$*"
	exit $?
fi
exit 0
