new: [cron] add check_error_odoo_log
This commit is contained in:
17
bin/cron/check_error_odoo_log
Executable file
17
bin/cron/check_error_odoo_log
Executable 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
|
5
etc/cron.d/check_odoo_log_errors
Normal file
5
etc/cron.d/check_odoo_log_errors
Normal 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
|
||||
|
Reference in New Issue
Block a user