I was able to get my MC server back up and running, so I've been playing with the code.
I've placed a new branch called 'world-admin' on github that has the create/delete and disable/enable options on the command line. The create world logic is also used to restore the ability of the script to function on its first run by creating a default world if no others are found. This branch might need some more work before I consider it done, and it definitely needs some more testing before I push it to master.
I haven't gotten around to adding in a auto port or name generator, but that logic could easily be added in now.
Cool, I will have to test. Hopefully I will have time, I really need to update my server.
I was thinking it would be nice to have a proxy built into the script. Here is my work-in-progress script that only currently functions as a proxy between two ports. It does have a couple of simple parsers to output the traffic to the screen, but not much else yet. The ultimate goal would be to allow users to jump between servers with a command, but that is a long ways from be realized.
#!/bin/sh
CLIENT_PORT=25565
SERVER_PORT=25566
SERVER_IP=127.0.0.1
BACK_PIPE=pipe.back
CLIENT_PIPE=pipe.client
SERVER_PIPE=pipe.server
rm -Rf "$BACK_PIPE" "$CLIENT_PIPE" "$SERVER_PIPE"
mkfifo -m 0600 "$BACK_PIPE" "$CLIENT_PIPE" "$SERVER_PIPE"
while true; do
# Parse the client and server pipes.
perl -ne '
$raw = $_;
$hex .= sprintf "%.2x", $_ foreach (unpack "C*", $raw);
print "\nClient - " . $raw . "\n" . $hex . "\n";
' "$CLIENT_PIPE" &
perl -ne '
$raw = $_;
$hex .= sprintf "%.2x", $_ foreach (unpack "C*", $raw);
print "\nServer - " . $raw . "\n" . $hex . "\n";
' "$SERVER_PIPE" &
# Listen for the next connection.
nc -l $CLIENT_PORT < "$BACK_PIPE" | tee -a "$CLIENT_PIPE" |
nc -q 1 $SERVER_IP $SERVER_PORT | tee -a "$SERVER_PIPE" > "$BACK_PIPE"
done
I was thinking it would be nice to have a proxy built into the script. Here is my work-in-progress script that only currently functions as a proxy between two ports. It does have a couple of simple parsers to output the traffic to the screen, but not much else yet. The ultimate goal would be to allow users to jump between servers with a command, but that is a long ways from be realized.
Sounds cool, then you wouldn't have to use screen to interact with worlds...or am I reading this wrong?
Sounds cool, then you wouldn't have to use screen to interact with worlds...or am I reading this wrong?
The server may not need to be run in a screen any more if we have a proxy, but I have no reason to start messing with that part of the script until the proxy stuff has been working for a while.
I merged the world-admin branch containing the create/delete and disable/enable code. I've been testing it for a week, and it seems to function just fine.
Would this script work with a MinecraftForge based server? I see it is configured for bukkit and vanilla minecraft. Would it be as simple as commenting out the two other server options and adding a Forge section?
Would this script work with a MinecraftForge based server? I see it is configured for bukkit and vanilla minecraft. Would it be as simple as commenting out the two other server options and adding a Forge section?
Probably. Let me know if you experience any issues and I'll try to come up with a patch/work around for you.
Note, there is a second branch on my github account called server.properties that should allow you to more easily use other server software than the basic Mojang supplied server. This branch will eventually be merged to master when I feel that enough testing has been done.
Question: how can I manage a previously already existing world?
Simply copy the "old world" to the world directory won't do it for me, it simply does not see my progress in the game, and starts from scratch.
Also tried to create a new world and copy my old world to the "new world dir" but that gave the same result.
Is this not possible, or am I missing something?
Hi. You just need to create a new directory for your world (suppose it is called 'alpha') in the world directory, and copy your world files over to that directory.
If you are in the directory that contains your world:
$ ls
alpha
banned-ips.txt
banned-players.txt
crash-reports
logs
ops.txt
server.properties
white-list.txt
Hey guys, I notice a few pages ago that there was discussion about the backup formats. I have been running a simple script previously (from the infancy days of this one) that was just running hourly tar.gz's that I would keep two days' worth of. I have just updated to the latest version of the script, with lots of awesome improvements - well done! But now my backups are a huge pile of files and increments that I am looking at thinking "how the heck would I recover to a point in time as simply as with the old way?"
I have the disk space to burn for tars, wondering what the intent is with backups?
Hey guys, I notice a few pages ago that there was discussion about the backup formats. I have been running a simple script previously (from the infancy days of this one) that was just running hourly tar.gz's that I would keep two days' worth of. I have just updated to the latest version of the script, with lots of awesome improvements - well done! But now my backups are a huge pile of files and increments that I am looking at thinking "how the heck would I recover to a point in time as simply as with the old way?"
I have the disk space to burn for tars, wondering what the intent is with backups?
Hey guys, I did as instructed and got the server up-and-running, but there seems to be a problem with the query. I updated query.port but status still says query server is offline.
Minecraft Server Status:
skyblock: running (query server offline).
Process ID: 3916.
Could it be a problem with permissions? Although I have created the "minecraft" user, I am working as root. A desperate "chmod -R 777 /home/minecraft/worlds/skyblock" also did not help.
Thanks!
Do you have query enabled in your server.properties?
Yes, I updated both query and server port to 25566 (because the mail world has 25565). enable-query is true.
I thought I had found all of the query bugs... I'm not sure what to blame for problems you are seeing.
Since the script checks for socat and prints an error if not found, I assume that it is installed and working correctly.
There is a 10 second sleep in the queryStart method to allow for the query server to have plenty of time to start. I assume that this error shows up even after those 10 seconds are up (during those 10 seconds, this is expected).
After starting the world server, do you see two new files (query.in and query.out) generated in the world's directory? Do these files grow in size when you run the status command? The query protocol is not ASCII, but you can run cat on the two files to verify that they contain something (cat will probably decode the strings properly, so you will be able to read some of it, but most will look like binary data).
You can now set a world to use the latest Minecraft snapshot version, a specific snapshot version, a specific release version, or as has always been the case, the latest Minecraft release version. This should give you admins out there using this script a way to more finely tune your setup.
I'm glad the script is working for you once again Praqoon. I only run vanilla servers, so I wasn't aware that CraftBukkit was no longer. I suppose I should edit the opening post to remove the note about it being a supported server type. The script itself doesn't have any CraftBukkit specific code, so no changes are needed there.
If you find any issues using any Craftbukkit-like servers (ie Forge), feel free to let me know and I can try to fix the problem.
Cool, I will have to test. Hopefully I will have time, I really need to update my server.
The server may not need to be run in a screen any more if we have a proxy, but I have no reason to start messing with that part of the script until the proxy stuff has been working for a while.
Probably. Let me know if you experience any issues and I'll try to come up with a patch/work around for you.
Note, there is a second branch on my github account called server.properties that should allow you to more easily use other server software than the basic Mojang supplied server. This branch will eventually be merged to master when I feel that enough testing has been done.
Hi. You just need to create a new directory for your world (suppose it is called 'alpha') in the world directory, and copy your world files over to that directory.
If you are in the directory that contains your world:
Then the following should work:
I have the disk space to burn for tars, wondering what the intent is with backups?
Thanks for a great script.
Backups use rdiff-backup which is incremental and only does a backup of what has changed instead of backing up everything every time. I contributed this patch a while ago and wrote some documentation on it.
https://github.com/sandain/MinecraftServerControlScript/wiki/Backup-and-Restore
I think there was a patch to restore the tgz backups but it's lost in the forums posts somewhere
Hi minecraftblogde.
I answered how to copy an existing world to the location the script uses in post #328 above.
I added "Import Existing Worlds" to the GitHub wiki
https://github.com/sandain/MinecraftServerControlScript/wiki#wiki-import-existing-worlds
Thanks zanix. I'll go ahead and add the same text to the OP.
Do you have query enabled in your server.properties?
I thought I had found all of the query bugs... I'm not sure what to blame for problems you are seeing.
Since the script checks for socat and prints an error if not found, I assume that it is installed and working correctly.
There is a 10 second sleep in the queryStart method to allow for the query server to have plenty of time to start. I assume that this error shows up even after those 10 seconds are up (during those 10 seconds, this is expected).
After starting the world server, do you see two new files (query.in and query.out) generated in the world's directory? Do these files grow in size when you run the status command? The query protocol is not ASCII, but you can run cat on the two files to verify that they contain something (cat will probably decode the strings properly, so you will be able to read some of it, but most will look like binary data).
https://github.com/sandain/MinecraftServerControlScript/wiki/Server.properties-Examples
I will continue to add more examples as I need them myself. I will also accept examples posted here or in the GitHub issue queue.
If you find any issues using any Craftbukkit-like servers (ie Forge), feel free to let me know and I can try to fix the problem.