postfix/files/start_postfix.sh
Petr "Stone" Hracek 8c2330e38f First set of tests
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
2017-04-25 13:37:11 +02:00

35 lines
800 B
Bash
Executable file

#!/bin/bash
# Copy all certificates
#cp /var/certs/*.{crt,pem} /etc/postfix/
# Wait before postfix is really started.
if [[ ! -z "${DEBUG_MODE}" ]]; then
rpm -q syslog-ng
if [[ $? -ne 0 ]]; then
dnf -y --setopt=tsflags=nodocs install syslog-ng && \
dnf -y clean all
syslog-ng
fi
fi
postfix start
while true; do
state=$(script -c 'postfix status' | grep postfix/postfix-script)
echo $state
if [[ "$state" != "${state/is running/}" ]]; then
PID=${state//[^0-9]/}
if [[ -z $PID ]]; then
continue
fi
if [[ ! -d "/proc/$PID" ]]; then
echo "Postfix proces $PID does not exist."
break
fi
sleep 10
else
echo "Postfix is not running."
break
fi
done