mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 22:50:18 -08:00
clean up log files with ANSI color codes
This commit is contained in:
@@ -29,7 +29,7 @@ log_message() {
|
||||
local message="$1"
|
||||
local log_file="$LOG_DIR/crontab-management.log"
|
||||
echo -e "$(date '+%Y-%m-%d %H:%M:%S') $message"
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') $message" | sed 's/\x1b\[[0-9;]*m//g' >> "$log_file"
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') $message" | sed 's/\\033\[[0-9;]*m//g' >> "$log_file"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
# Validates integrity of .env backup repository
|
||||
30 8 * * 0 { echo "Starting .env backup validation"; /home/acedanger/shell/validate-env-backups.sh; echo ".env validation completed with exit code: $?"; } 2>&1 | logger -t env-validation -p user.info
|
||||
|
||||
# Weekly log files ANSI cleanup (Sundays at 0900)
|
||||
# Removes ANSI color codes from log files to improve readability and reduce size
|
||||
0 9 * * 0 { echo "Starting log ANSI cleanup"; /home/acedanger/shell/cleanup-log-ansi.sh --auto-discover --backup >/dev/null; echo "Log cleanup completed with exit code: $?"; } 2>&1 | logger -t log-cleanup -p user.info
|
||||
|
||||
# Optional: Add a health check entry to monitor cron jobs (every 6 hours)
|
||||
# This can help detect if any of the backup processes are failing
|
||||
# 0 */6 * * * { echo "Cron health check - all backup jobs scheduled"; ps aux | grep -E "(backup-plex|validate-plex|move-backups)" | grep -v grep | wc -l; } 2>&1 | logger -t cron-health -p user.info
|
||||
|
||||
Reference in New Issue
Block a user