install_postfix_base.sh, install_postfix_advanced.sh: support for setting up cronjobs..

This commit is contained in:
Christoph 2022-12-28 18:30:17 +01:00
parent d7e5a9e0fe
commit f28d189d4a
2 changed files with 85 additions and 0 deletions

View File

@ -3355,6 +3355,49 @@ else
fi
## - Install a cronjob for checking if mailservice is running..
## -
echononl " Install a cronjob for checking if mailservice is running.."
crontab -l > /tmp/tmp_crontab
if ! grep -q -E "/root/bin/monitoring/check_postfix.sh" /tmp/tmp_crontab 2> /dev/null ; then
echo "" >> /tmp/tmp_crontab
echo "# - Check if postfix mailservice is running. Restart service if needed." >> /tmp/tmp_crontab
echo "# -" >> /tmp/tmp_crontab
echo "*/5 * * * * /root/bin/monitoring/check_postfix.sh" >> /tmp/tmp_crontab
crontab /tmp/tmp_crontab > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
else
echo_skipped
fi
## - Install a cronjob that checks the LOG file for fatal errors..
## -
echononl " Install a cronjob that checks the LOG file for fatal errors.."
crontab -l > /tmp/tmp_crontab
if ! grep -q -E "/root/bin/postfix/check-postfix-fatal-errors.sh" /tmp/tmp_crontab 2> /dev/null ; then
echo "" >> /tmp/tmp_crontab
echo "# - Check Postfix E-Mail LOG file for 'fatal' errors.." >> /tmp/tmp_crontab
echo "# -" >> /tmp/tmp_crontab
echo "*/5 * * * * /root/bin/postfix/check-postfix-fatal-errors.sh" >> /tmp/tmp_crontab
crontab /tmp/tmp_crontab > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
else
echo_skipped
fi
## - restart postfix
## -
echononl " Restart postfix"

View File

@ -1046,6 +1046,48 @@ else
echo_skipped
fi
## - Install a cronjob for checking if mailservice is running..
## -
echononl " Install a cronjob for checking if mailservice is running.."
crontab -l > /tmp/tmp_crontab
if ! grep -q -E "/root/bin/monitoring/check_postfix.sh" /tmp/tmp_crontab 2> /dev/null ; then
echo "" >> /tmp/tmp_crontab
echo "# - Check if postfix mailservice is running. Restart service if needed." >> /tmp/tmp_crontab
echo "# -" >> /tmp/tmp_crontab
echo "*/5 * * * * /root/bin/monitoring/check_postfix.sh" >> /tmp/tmp_crontab
crontab /tmp/tmp_crontab > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
else
echo_skipped
fi
## - Install a cronjob that checks the LOG file for fatal errors..
## -
echononl " Install a cronjob that checks the LOG file for fatal errors.."
crontab -l > /tmp/tmp_crontab
if ! grep -q -E "/root/bin/postfix/check-postfix-fatal-errors.sh" /tmp/tmp_crontab 2> /dev/null ; then
echo "" >> /tmp/tmp_crontab
echo "# - Check Postfix E-Mail LOG file for 'fatal' errors.." >> /tmp/tmp_crontab
echo "# -" >> /tmp/tmp_crontab
echo "*/5 * * * * /root/bin/postfix/check-postfix-fatal-errors.sh" >> /tmp/tmp_crontab
crontab /tmp/tmp_crontab > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
else
echo_skipped
fi
## - rebuld alias database
## -
echononl " Rebuld alias database"