Vote count:
0
I am trying to set up a Minecraft server. However, the basic startup scripts provided do not fit my needs. I want a script that will:
- Start a new
screenrunning the jarfile and (pretty much) only the jarfile (so i can^Cit if needed without killing other things like screen or my gzip commands) - Gzip any logs that weren't gzipped automatically by the jarfile (for if/when i
^C'ed the server, or if it crashed) - Run a command with
sudoto set the process in the first argument to a high priority (/usr/bin/oom-priority) - Run a
http-serveron theresource-packdirectory in a differentscreenand send^Cto it when the server closes
I have three commands. I run startserver to start the server.
startserver:
#!/bin/bash
set -m
cd /home/minecraftuser/server/
echo
screen -dm -S http-server http-server ./resource-pack
screen -dm -S my-mc-server startserver_command
(sleep 1; startserver_after) &
screen -S my-mc-server
startserver_command:
#!/bin/bash
set -m
cd /home/minecraftuser/server/
echo
java -Xmx768M -Xms768M -jar ./craftbukkit.jar $@ &
env MC_PID=$! &
(sleep 0.5; sudo /usr/bin/oom-priority $MC_PID)
fg 1
echo
read -n 1 -p 'Press any key to continue...'
and startserver_after:
#!/bin/bash
cd /home/minecraftuser/server/
wait $MC_PID
find /home/minecraftuser/server/logs -type f -name "*.log" -print | while read file; do gzip $file &
done
screen -S http-server -p 0 -X stuff \^c\\r
asked 3 mins ago
Aucun commentaire:
Enregistrer un commentaire