File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ RUN set -eux; \
66 apk add --no-cache dma msmtp s-nail tini; \
77 mv /etc/dma/dma.conf /etc/dma/dma.conf.default
88
9- COPY entrypoint.sh sendmail-in-ctr.sh /
9+ COPY entrypoint.sh /
10+ COPY utils/ /utils/
1011
1112ENTRYPOINT ["/entrypoint.sh" ]
1213CMD ["msmtpd" ]
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description =invocation log emailer for %i
3+
4+ [Service]
5+ Environment =EMAIL_TGTS =user@example.com
6+ Environment =EMAIL_SUBJ ='Service %i on host %H entered state: $STATE'
7+ Environment =EMAIL_TPL ='Logs for service %i:\n $LOGS'
8+ # Environment=SD_ARGS=--user
9+
10+ SyslogIdentifier =logmailer
11+ SyslogLevel =err
12+ Type =oneshot
13+ ExecStart =/bin/sh -euc '\
14+ inv=$(systemctl ${SD_ARGS} show -P InvocationID %i | grep ^.) \n \
15+ STATE=$(systemctl ${SD_ARGS} is-active %i || true) \n \
16+ LOGS=$(journalctl ${SD_ARGS} --all --no-hostname \
17+ INVOCATION_ID=$$inv \
18+ + USER_INVOCATION_ID=$$inv \
19+ + _SYSTEMD_INVOCATION_ID=$$inv) \n \
20+ sendmail -i "$1" <<_TPL_EOF\n Subject: ${EMAIL_SUBJ}\n\n ${EMAIL_TPL}\n _TPL_EOF\n \
21+ ' -- $EMAIL_TGTS
File renamed without changes.
You can’t perform that action at this time.
0 commit comments