Refactor log handling

This commit is contained in:
Adrien Ferrand 2020-03-01 17:33:13 +01:00
parent 586b0d01e5
commit 2fad465e51
2 changed files with 10 additions and 2 deletions

View File

@ -90,11 +90,13 @@ if [ -f /firstrun ]; then
# Configure standard mail delivery parameters (may be overriden by backuppc user-wide config)
echo "account default" > /etc/msmtprc
echo "logfile /var/log/msmtp.log" >> /etc/msmtprc
echo "host ${SMTP_HOST:-mail.example.org}" >> /etc/msmtprc
echo "auto_from on" >> /etc/msmtprc
if [ "${SMTP_MAIL_DOMAIN:-}" != "" ]; then
echo "maildomain ${SMTP_MAIL_DOMAIN}" >> /etc/msmtprc
echo "from %U@${SMTP_MAIL_DOMAIN}" >> /etc/msmtprc
fi
touch /var/log/msmtp.log
chown "${BACKUPPC_USERNAME}:${BACKUPPC_GROUPNAME}" /var/log/msmtp.log
# Clean
rm -rf /root/BackupPC-$BACKUPPC_VERSION.tar.gz /root/BackupPC-$BACKUPPC_VERSION /firstrun

View File

@ -36,3 +36,9 @@ redirect_stderr = true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
user = %(ENV_BACKUPPC_USERNAME)s
[program:watchmails]
command = tail -f /var/log/msmtp.log
redirect_stderr = true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0