Update start.sh
Browse files11 unmodified lines1213141515161718192020212223242526272829303148 unmodified lines808182758384858687808889909136 unmodified lines12812913012313113213324 unmodified lines15815916015416116211 unmodified lines cd /app/serverfi
# Clean up old jars to force auto-updates# Clean up old jars and setup logsrm -f plugins/Via*.jarrm -f plugins/EaglerX*.jarmkdir -p logs
# 2. Download Paper 1.12.2# 2. Self-Healing PaperMC Downloadif [ -f "server.jar" ]; then # Test if the jar is corrupted. If it is, delete it! if ! jar tf server.jar >/dev/null 2>&1; then echo "[System] server.jar is corrupted! Deleting for a fresh download..." rm -f server.jar fifi
if [ ! -f "server.jar" ]; then echo "[System] Downloading Paper 1.12.2..." wget -q -O server.jar https://api.papermc.io/v2/projects/paper/versions/1.12.2/builds/1620/downloads/paper-1.12.2-1620.jar48 unmodified linesconsole.log(' Starting Eaglercraft & Web Console ');console.log('=========================================');
// A. Launch the Minecraft Server as a Child Process of Node!// A. Launch the Minecraft Server as a Child Process of Nodeconst mcProcess = spawn('java', ['-Xms2G', '-Xmx2G', '-jar', 'server.jar', 'nogui'], { cwd: '/data'});
// B. Route Minecraft's output to the log file AND to the Hugging Face console// B. Route Minecraft's outputconst logStream = fs.createWriteStream('/data/logs/latest.log', { flags: 'w' });mcProcess.stdout.pipe(logStream);mcProcess.stderr.pipe(logStream);36 unmodified lines req.on('data', c => body += c); req.on('end', () => { const cmd = new URLSearchParams(body).get('cmd'); // Pipe the command directly into the Minecraft Java process if (cmd && mcProcess.stdin.writable) { mcProcess.stdin.write(cmd + '\n'); }24 unmodified linesserver.listen(7860, () => console.log('[WebConsole] Listening on Port 7860...'));EOF
# 8. Start the Master Controller (This runs everything!)# 8. Start the Master Controllerexec node /app/webconsole.jsstart.sh+13-6