User blog comment:LOTRMod/Auto-Downloads/@comment-25612015-20150313001823/@comment-25612015-20150313064227

Rather than testing if the file is empty (which is easy), i process it with a NBT tag filter (nbtedit). If there's an error, that means the NBT structure inside the file is incorrect and i discard the file.

There's no need to check if the file is accessed. This status might change between the time needed to get the answer, and launch the next command. Doing a quick copy is as good as you will get. I process it with nbtedit after on the copy.

Finally, there's no need to download/upload the file anywhere (though you should externalise full backups of the Minecraft folder from time to time). If you have a resetted LOTR.dat, you will need the backup copies on the server for restoration anyway, so forget things like wget, curl, fetch and so on.

Is the official server running under Windows? Without starting an OS war, it would run better and with more control under Unix (no overhead because of loading a UI in memory and waiting constantly for user events (clicks).