Files
crm.clientright.ru/monitor_logs_safe.sh

33 lines
1.0 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Безопасный мониторинг логов без inotify
echo "=== Безопасный мониторинг логов CRM ==="
echo "Нажмите Ctrl+C для выхода"
echo ""
# Функция для мониторинга с интервалом
monitor_logs() {
while true; do
echo "=== $(date) ==="
# Проверяем Apache error log
if [ -f /var/log/apache2/error.log ]; then
echo "--- Apache Error Log (последние 5 строк) ---"
tail -5 /var/log/apache2/error.log | grep -v "GPL Ghostscript"
fi
# Проверяем PHP error log
if [ -f /var/www/fastuser/data/www/crm.clientright.ru/logs/php_errors.log ]; then
echo "--- PHP Error Log (последние 5 строк) ---"
tail -5 /var/www/fastuser/data/www/crm.clientright.ru/logs/php_errors.log | grep -v "GPL Ghostscript"
fi
echo ""
sleep 10
done
}
# Запускаем мониторинг
monitor_logs