This commit is contained in:
Andy 2018-12-17 13:33:44 +01:00
parent d493b877b3
commit 448ebf7cf1
Signed by: arno
GPG Key ID: 9076D5E6B31AE99C
9 changed files with 35 additions and 10 deletions

View File

@ -3,10 +3,12 @@ MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
RUN apk update && \
apk upgrade && \
apk add tzdata rsyslog postfix runit ca-certificates
apk add postfix runit socklog tzdata ca-certificates && \
rm -rf /etc/service
# tzdata - for passing TZ environment variable.
# rsyslog - to log postfix service into /var/log/maillog file.
# socklog - collect all logs which come to /dev/log.
COPY service /etc/service/
COPY service /etc/service
ENTRYPOINT runsvdir -P /etc/service
#ENTRYPOINT chpst -Unobody socklog unix /dev/log & postfix start-fg

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "${PWD##*/}: Exitted with $1 (signal: $2)"
[ $1 -ne 0 ] && ( echo "${PWD##*/}: rc != 0, sleeping for 5 seconds ..."; sleep 5 )

View File

@ -1,3 +1,6 @@
#!/bin/sh
echo "${PWD##*/}: started."
touch /var/log/maillog
exec /usr/sbin/rsyslogd -n 2>&1

4
service/logger/finish Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "${PWD##*/}: Exitted with $1 (signal: $2)"
[ $1 -ne 0 ] && ( echo "${PWD##*/}: rc != 0, sleeping for 5 seconds ..."; sleep 5 )

10
service/logger/run Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Collect all logs which come to /dev/log
exec 2>&1
echo "${PWD##*/}: started."
set -x
exec chpst -Unobody socklog unix /dev/log
# exec socklog unix /dev/log
# exec socat UNIX-LISTEN:/dev/log,reuseaddr,fork -

View File

@ -1,3 +1,4 @@
#!/bin/sh
[ $1 -ne 0 ] && ( echo "${PWD##*/}: Exitted with $1 (signal: $2)"; sleep 5 )
echo "${PWD##*/}: Exitted with $1 (signal: $2)"
[ $1 -ne 0 ] && ( echo "${PWD##*/}: rc != 0, sleeping for 5 seconds ..."; sleep 5 )

View File

@ -1,5 +1,7 @@
#!/bin/sh
echo "${PWD##*/}: started."
# WORKAROUND:
# postfix has to be aware of the DNS servers
# without this workaround it uses 127.0.0.1:53 for some unknown (yet) reason...
@ -13,6 +15,8 @@ set -e
postfix check 2>&1
# run Postfix
# exec /usr/lib/postfix/master 2>&1
# after postfix 3.3.0 use postfix start-fg command
exec postfix start-fg 2>&1
exec /usr/lib/postfix/master 2>&1
# Do not use 'postfix start-fg' command since it does not handle the signals,
# e.g. if you do 'sv restart postfix', postfix/master will NOT receive the
# SIGTERM signal.

View File

@ -1,3 +0,0 @@
#!/bin/sh
[ $1 -ne 0 ] && ( echo "${PWD##*/}: Exitted with $1 (signal: $2)"; sleep 5 )