diff --git a/root/etc/cron.monthly/maillog-rotate b/root/etc/cron.monthly/maillog-rotate index 731e98e..3744a16 100644 --- a/root/etc/cron.monthly/maillog-rotate +++ b/root/etc/cron.monthly/maillog-rotate @@ -11,8 +11,16 @@ if [ "$BCC" != "enabled" -o "$ARCHIVE" != "enabled" ]; then fi USER=$(db configuration getprop qpsmtpd BccUser || echo 'maillog') +# Truncate if it's a mail address +USER=${USER%@*} HOME="/home/e-smith/files/users/$USER" +# Stop here if the home dir doesn't exist +if [ \! -d $HOME ]; then + echo "$HOME doesn't exist" + exit 1 +fi + MONTH=$(date +%m) YEAR=$(date +%Y)