- check-syntax.sh: Pre-compilation syntax checker for MT4→MT5 issues - metaeditor-watchdog.sh: Auto-kills stuck MetaEditor processes - safe-compile.sh: Wrapper with 2-minute timeout for compilations These tools help prevent the container freeze that occurred when trying to compile OrdersEA with 100 MT4 syntax errors.
32 lines
824 B
Bash
Executable File
32 lines
824 B
Bash
Executable File
#!/bin/bash
|
|
# Safe compilation wrapper
|
|
|
|
echo "=== Safe Compile Mode ==="
|
|
echo ""
|
|
echo "1. Checking file syntax first..."
|
|
|
|
echo ""
|
|
echo "2. Killing any existing MetaEditor processes..."
|
|
docker exec mt5 pkill -9 metaeditor64 2>/dev/null
|
|
sleep 2
|
|
|
|
echo ""
|
|
echo "3. Starting MetaEditor in background with timeout..."
|
|
# MetaEditor has 2 minute timeout
|
|
timeout 120 docker exec mt5 wine "/config/.wine/drive_c/Program Files/MetaTrader 5/metaeditor64.exe" "$@" 2>&1 &
|
|
PID=$!
|
|
|
|
echo ""
|
|
echo "4. Monitoring for 2 minutes max..."
|
|
wait $PID
|
|
EXITCODE=$?
|
|
|
|
if [ $EXITCODE -eq 124 ]; then
|
|
echo "⚠️ Compilation timed out - MetaEditor was killed"
|
|
docker exec mt5 pkill -9 metaeditor64 2>/dev/null
|
|
elif [ $EXITCODE -eq 0 ]; then
|
|
echo "✅ Compilation completed"
|
|
else
|
|
echo "⚠️ Compilation exited with code $EXITCODE"
|
|
fi
|