feat: add place gate population scripts, map style assets, automated cron sync tasks, and expand dashboard and landing applications
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# SIRO Maps — Weekly Maintenance & Log Cleanup Script
|
||||
# ==============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
APP_DIR="${APP_DIR:-/home/hamzadoctor/app}"
|
||||
LOG_DIR="${APP_DIR}/logs"
|
||||
RETENTION_DAYS=14
|
||||
|
||||
echo "🧹 [$(date '+%Y-%m-%d %H:%M:%S')] Starting weekly log and docker maintenance..."
|
||||
|
||||
# 1. Clean old log files
|
||||
if [ -d "$LOG_DIR" ]; then
|
||||
find "$LOG_DIR" -type f -name "*.log" -mtime +"$RETENTION_DAYS" -exec rm -f {} +
|
||||
echo "✅ Removed log files older than ${RETENTION_DAYS} days."
|
||||
fi
|
||||
|
||||
# 2. Truncate current active logs if they exceed 50MB
|
||||
for log in "$LOG_DIR"/*.log; do
|
||||
if [ -f "$log" ]; then
|
||||
size=$(stat -c%s "$log" 2>/dev/null || stat -f%z "$log" 2>/dev/null || echo 0)
|
||||
if [ "$size" -gt 52428800 ]; then # 50MB
|
||||
tail -n 10000 "$log" > "${log}.tmp" && mv "${log}.tmp" "$log"
|
||||
echo "✂️ Truncated large log file: $log"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# 3. Clean dangling docker images and build cache
|
||||
docker image prune -f --filter "until=168h" > /dev/null 2>&1 || true
|
||||
docker builder prune -f --keep-storage 2GB > /dev/null 2>&1 || true
|
||||
|
||||
echo "🏁 [$(date '+%Y-%m-%d %H:%M:%S')] Cleanup completed successfully."
|
||||
Reference in New Issue
Block a user