All pastes #2131085 Raw Edit

Someone

public shellscript v1 · immutable
#2131085 ·published 2012-03-22 11:36 UTC
rendered paste body
#!/bin/bash## full path to mcmap binarycd /minecraft/mcmap/## path to your worldWORLD=/minecraft/world/## path to write output image toOUTPUT="/var/www/maps"## see below to change the area to render (lines that start with ##)################################FILE=history-`date +%s`.pngOLD5=noneOLD6=noneif [ -e "$OUTPUT/output.day.png" ]; then        OLD5=`md5sum $OUTPUT/output.day.png | cut -b 1-32`fiif [ -e "$OUTPUT/output.night.png" ]; then        OLD6=`md5sum $OUTPUT/output.night.png | cut -b 1-32`fiCHECK=`date +%k`if [ $CHECK -ge "7" ] && [ $CHECK -le "20" ]; then        NIGHT="-skylight"        NIGHTSTATUS="0"else        NIGHT="-skylight -night"        NIGHTSTATUS="1"fi## change the values here to define the area to render#./mcmap -png $NIGHT -from -40 -60 -to 20 20 "$WORLD" > /dev/null## if you want the whole world, use:./mcmap -png "$WORLD" $NIGHT > /dev/nullRET=$?if [ "$RET" -ne "0" ]; then        echo "Error creating image for $FILE"        exit 1;fiNEW5=`md5sum output.png | cut -b 1-32`if [ "$OLD5" != "$NEW5" ] && [ "$OLD6" != "$NEW5" ]; then        mkdir -p $OUTPUT/history/        pngcrush output.png $OUTPUT/history/$FILE > /dev/null        if [ "$NIGHTSTATUS" -eq "1" ]; then                mv output.png $OUTPUT/output.night.png        else                mv output.png $OUTPUT/output.day.png        fifi