← back to Designer Wallcoverings
DW-Agents/data/control-panel_fixes.sh
32 lines
#!/bin/bash
# Auto-generated fixes for AGENT_NAME
AGENT_NAME="control-panel"
AGENT_DIR="/root/Projects/Designer-Wallcoverings/DW-Agents/dw-agents"
LOG_FILE="/root/Projects/Designer-Wallcoverings/DW-Agents/logs/fixes.log"
log_fix() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >> "$LOG_FILE"
}
apply_fixes() {
log_fix "🔧 Applying fixes for $AGENT_NAME"
# Restart agent with monitoring
log_fix "🚀 Restarting $AGENT_NAME with enhanced monitoring"
pm2 restart "$AGENT_NAME"
sleep 5
# Verify restart was successful
local status=$(pm2 jlist | jq -r ".[] | select(.name==\"$AGENT_NAME\") | .pm2_env.status")
if [ "$status" = "online" ]; then
log_fix "✅ $AGENT_NAME successfully restarted and is online"
return 0
else
log_fix "❌ $AGENT_NAME failed to restart properly"
return 1
fi
}
apply_fixes