#!/bin/sh
exec 2>&1
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
CDIR=`postconf -h command_directory`
DDIR=`postconf -h daemon_directory`

if [ -z "${CDIR}" ]; then
	CDIR=/usr/sbin
fi
if [ -z "${DDIR}" ]; then
	DDIR=/usr/lib/postfix
fi

for prog in ${DDIR}/master ${CDIR}/postfix; do
	if [ ! -x ${prog} ]; then
		echo ${prog} not executable
	fi
done

# stop postfix if running
${DDIR}/master -t || ${CDIR}/postfix stop

# check local installation, then run
${CDIR}/postfix check 
exec ${DDIR}/master 
