2022-10-17 08:40:09 +00:00
|
|
|
#!/bin/bash
|
2020-09-05 14:19:12 +00:00
|
|
|
|
2017-08-07 15:39:40 +00:00
|
|
|
# You cannot start postfix in some foreground mode and
|
|
|
|
# it's more or less important that docker doesn't kill
|
|
|
|
# postfix and its chilren if you stop the container.
|
|
|
|
#
|
|
|
|
# Use this script with supervisord and it will take
|
|
|
|
# care about starting and stopping postfix correctly.
|
|
|
|
#
|
|
|
|
# supervisord config snippet for postfix-wrapper:
|
|
|
|
#
|
|
|
|
# [program:postfix]
|
|
|
|
# process_name = postfix
|
|
|
|
# command = /path/to/postfix-wrapper.sh
|
|
|
|
# startsecs = 0
|
|
|
|
# autorestart = false
|
|
|
|
#
|
|
|
|
|
|
|
|
trap "service postfix stop" SIGINT
|
|
|
|
trap "service postfix stop" SIGTERM
|
|
|
|
trap "service postfix reload" SIGHUP
|
|
|
|
|
2021-08-28 23:16:34 +00:00
|
|
|
service postfix start
|
2017-08-07 15:39:40 +00:00
|
|
|
|
|
|
|
# wait until postfix is dead (triggered by trap)
|
2020-09-23 19:53:07 +00:00
|
|
|
while kill -0 "$(< /var/spool/postfix/pid/master.pid)"
|
2020-09-05 14:19:12 +00:00
|
|
|
do
|
2021-08-28 23:16:34 +00:00
|
|
|
sleep 5
|
2017-08-07 15:39:40 +00:00
|
|
|
done
|