new: [cron] add check_error_odoo_log

This commit is contained in:
Boris Gallet
2025-05-12 17:50:10 +02:00
parent 88b131634a
commit edac7927e3
2 changed files with 22 additions and 0 deletions

17
bin/cron/check_error_odoo_log Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
ODOO_SERVICE_NAME=$(compose status -c name,charm -r | grep odoo-tecnativa | cut -d" " -f1)
if [ -z "$ODOO_SERVICE_NAME" ]; then
echo "Odoo service not found"
exit 1
fi
ODOO_LOG="/srv/datastore/data/$ODOO_SERVICE_NAME/var/log/odoo/odoo.log"
odoo_daily_errors=$(cat "$ODOO_LOG" | grep $(date -I) | grep ERROR)
if [ -n "$odoo_daily_errors" ]; then
send -c odoo.err -t "Odoo daily Errors" "$odoo_daily_errors"
#echo "$odoo_daily_errors"
fi

View File

@@ -0,0 +1,5 @@
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
30 23 * * * root lock odoo_log_errors -v -D -p 10 -k -c "/opt/apps/elab-manage/bin/cron/check_error_odoo_log" 2>&1 | logger -t check-error-odoo-log