Andrey Arapov 3 months ago
parent
commit
448ebf7cf1
Signed by: Andrey Arapov <andrey.arapov@nixaid.com> GPG Key ID: 9076D5E6B31AE99C

+ 5
- 3
Dockerfile View File

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

+ 4
- 0
service-disabled/rsyslogd/finish View File

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

service/rsyslogd/log/run → service-disabled/rsyslogd/log/run View File


service/rsyslogd/run → service-disabled/rsyslogd/run View File

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

+ 4
- 0
service/logger/finish View File

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

+ 10
- 0
service/logger/run View File

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

+ 2
- 1
service/postfix/finish View File

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

+ 7
- 3
service/postfix/run View File

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

+ 0
- 3
service/rsyslogd/finish View File

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

Loading…
Cancel
Save