install_amavis.sh: write crontop for checking, if AMaVis is running.
This commit is contained in:
parent
81bc06e7fc
commit
1a875c003e
@ -3600,6 +3600,81 @@ else
|
||||
fi
|
||||
|
||||
|
||||
## - Add a crontab to check if AMaViS is running.
|
||||
## -
|
||||
echononl " Add a cronjobs to to check if AMaViS is running .."
|
||||
if [[ -f "/root/bin/monitoring/check_amavis.pl" ]]; then
|
||||
if [[ -f "$crontab_backup_file" ]]; then
|
||||
if ! $(grep -q -E "*\s+/root/bin/monitoring/check_amavis.pl\s+" "$crontab_backup_file" 2>/dev/null) ; then
|
||||
cat << EOF >> $crontab_backup_file
|
||||
|
||||
# - Check if Amavis is running. Restart service if needed..
|
||||
# -
|
||||
*/5 * * * * /root/bin/monitoring/check_amavis.pl -f postmaster -t do-not-reply -s 127.0.0.1 -p 10024
|
||||
EOF
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_done
|
||||
else
|
||||
echo_failed
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
fi
|
||||
elif [[ -f "/var/spool/cron/crontabs/root" ]] ; then
|
||||
|
||||
installed=false
|
||||
installation_failed=false
|
||||
|
||||
crontab -l > /tmp/tmp_crontab 2> $tmp_err_msg
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
installation_failed=true
|
||||
fi
|
||||
|
||||
if ! $(grep -q -E "*\s+/root/bin/monitoring/check_amavis.pl\s+" "/tmp/tmp_crontab" 2>/dev/null) ; then
|
||||
|
||||
cat << EOF >> /tmp/tmp_crontab
|
||||
|
||||
# - Check if Amavis is running. Restart service if needed..
|
||||
# -
|
||||
*/5 * * * * /root/bin/monitoring/check_amavis.pl -f postmaster -t do-not-reply -s 127.0.0.1 -p 10024
|
||||
EOF
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
installation_failed=true
|
||||
fi
|
||||
|
||||
crontab /tmp/tmp_crontab > /dev/null 2>> $tmp_err_msg
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
installation_failed=true
|
||||
fi
|
||||
|
||||
rm /tmp/tmp_crontab > /dev/null 2>> $tmp_err_msg
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
installation_failed=true
|
||||
fi
|
||||
|
||||
if ! $installation_failed ; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
fi
|
||||
|
||||
else
|
||||
echo_skipped
|
||||
rm /tmp/tmp_crontab > /dev/null 2>> $tmp_err_msg
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
installation_failed=true
|
||||
fi
|
||||
if $installation_failed ; then
|
||||
error "$(cat $tmp_err_msg)"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
fi
|
||||
|
||||
## - Add a crontab to cleanup the quarantine folder
|
||||
## -
|
||||
echononl " Add a cronjobs to cleanup the quarantine folder"
|
||||
|
Loading…
Reference in New Issue
Block a user