install_postfix_base.sh, install_postfix_advanced.sh: support for setting up cronjobs..
This commit is contained in:
parent
d7e5a9e0fe
commit
f28d189d4a
@ -3355,6 +3355,49 @@ else
|
|||||||
fi
|
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
|
## - restart postfix
|
||||||
## -
|
## -
|
||||||
echononl " Restart postfix"
|
echononl " Restart postfix"
|
||||||
|
@ -1046,6 +1046,48 @@ else
|
|||||||
echo_skipped
|
echo_skipped
|
||||||
fi
|
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
|
## - rebuld alias database
|
||||||
## -
|
## -
|
||||||
echononl " Rebuld alias database"
|
echononl " Rebuld alias database"
|
||||||
|
Loading…
Reference in New Issue
Block a user