Although I did post this on the Minecraft Forums, I think I should post this here for anyone who wants to see how simple this script is.
What it does is to take a copy of the Minecraft map and copy it to a folder for people to grab (also good for backups when someone TNTs the hell out of your map). If you have any suggestions/improvements, feel free to comment.
(To stop the spamming of rubbish your RSS reader won’t understand I’ll put the code under the break.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #!/bin/bash # Minecraft World Snapshotter # Version 1.0 # Created by Simon Cook (simon@simoncook.org) ## CONFIG START # WORLD contains the name of the directory the Minecraft world is in WORLD="world" # FILENAME contains the name that will be appended with the date FILENAME="world2-" # DATE contains the date formatting to be used for a file name DATE="%Y%m%d-%H%M%S" # TYPE defines the file type to create (valid: tar bz2 7z zip) TYPE="7z" # DEST if valid, the snapshot will be copied or moved to this directory DEST="/var/www/simoncook.org/web/static/minecraft/" # CPMV is whether to move or copy if DEST is valid (valid: cp mv) CPMV="cp" ## CONFIG END ## DO NOT EDIT UNDER THIS LINE FILENAME=$FILENAME`date +$DATE` if ! [ -d "$WORLD" ]; then echo "Sorry, World \"$WORLD\" does not exist!" exit 1 fi if [ "$TYPE" == "tar" ]; then FILENAME=$FILENAME.tar tar cf $FILENAME $WORLD echo "Snapshot created as $FILENAME" elif [ "$TYPE" == "bz2" ]; then FILENAME=$FILENAME.tar tar cf $FILENAME $WORLD bzip2 -9 $FILENAME FILENAME=$FILENAME.bz2 echo "Snapshot created as $FILENAME" elif [ "$TYPE" == "7z" ]; then FILENAME=$FILENAME.7z 7za a -mx9 $FILENAME $WORLD echo "Snapshot created as $FILENAME" elif [ "$TYPE" == "zip" ]; then FILENAME=$FILENAME.zip zip -9rq $FILENAME $WORLD echo "Snapshot created as $FILENAME" fi if [ -d "$DEST" ]; then if [ "$CPMV" == "mv" ]; then mv $FILENAME $DEST echo "File moved to $DEST" elif [ "$CPMV" == "cp" ]; then cp $FILENAME $DEST echo "File copied to $DEST" fi fi |

