31 lines
707 B
Bash
Executable File
31 lines
707 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
today=$(date -I)
|
|
|
|
odoo_services=$(compose status -c name,charm -r 2>&1 | grep "odoo-tecnativa" || true)
|
|
|
|
if [ -z "$odoo_services" ]; then
|
|
echo "Odoo service not found"
|
|
exit 1
|
|
fi
|
|
|
|
echo "$odoo_services" | while read -r line; do
|
|
|
|
service=${line%% *}
|
|
service=${service#0:}
|
|
|
|
ODOO_LOG="/srv/datastore/data/$service/var/log/odoo/odoo.log"
|
|
|
|
if [ ! -f "$ODOO_LOG" ]; then
|
|
echo "Log file not found for $service: $ODOO_LOG"
|
|
continue
|
|
fi
|
|
|
|
odoo_daily_errors=$(grep "$today" "$ODOO_LOG" | grep ERROR || true)
|
|
|
|
if [ -n "$odoo_daily_errors" ]; then
|
|
send -c odoo.err -t "Odoo daily Errors - $service" "$odoo_daily_errors"
|
|
fi
|
|
done
|