Witam, znalazłem wiele tematów na temat automatycznego restartu serwera, ale totalnie nic mi nie pomogło. Sam cron działa, wyłącza serwer o podanej godzinie. Niestety serwer po restarcie się nie włącza, próbowałem chyba wszystkiego co ludzie pisali. Po wpisaniu w konsole bash start.sh serwer ładnie się włącza, nie działa to tylko przy resecie. Skrypt od restartu:
#!/bin/bash screen -p 0 -S x -X stuff "broadcast &cRestart servera za...$(echo '\r')" sleep 10 screen -p 0 -S x -X stuff "broadcast &33$(echo '\r')" sleep 10 screen -p 0 -S x -X stuff "broadcast &32$(echo '\r')" sleep 10 screen -p 0 -S x -X stuff "broadcast &31$(echo '\r')" sleep 10 screen -p 0 -S x -X stuff "broadcast &4&lRestart!$(echo '\r')" sleep 10 screen -p 0 -S x -X stuff "save-all$(echo '\r')" sleep 5 screen -p 0 -S x -X stuff "kickall §4RESTART$(echo '\r')" sleep 10 screen -p 0 -S x -X stuff "stop$(echo '\r')" sleep 360 cd /home/mc1 bash start.sh
Skrypt od startu:
#!/bin/bash /usr/bin/screen -dmS x java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar serw.jar nogui
