Jump to content

Archived

This topic is now archived and is closed to further replies.

Dateranoth

Minecraft Alpha Server Backup Utility

Recommended Posts

Minecraft Alpha Server Backup Utility. ( Should work with Single Player too if you wanted )

Latest Version 3.1 here:

http://www.gamercide...ckuppackage.zip

Important, Please read!

V3.1 has adopted the Direct to Tile version of Overviewer. Support for older versions have been dropped though they can still be used. If you wish to keep the older versions you will need to rename gmap.py or gmap.exe to overviewer.py or overviewer.exe . You will then need to change the overviewer options to comply with the older version. I highly suggest updating to the DTT version as it is much faster and doesn't require the first caching stage. It also allows you to render more than one mode at a time. Refer to the settings for more information. There is now an Overviewer OPTIONS setting allowing you to customize the commands. Finally, support for sessions in WinSCP has been added. This is only necessary if you are Backing up from a Remote Server who's timezone is different from yours.

V3.0 Supports Backing up Remote servers. Do you have a server host such as xenonservers.com with no way to backup your files or run mapping software? Now you can. Simply follow the directions below and the script will connect to your server via FTP, download the files and then run the backup and mapping process like you were running the server on your own machine. Not the best solution, but it's better than nothing. If using this for remote server backup, saveall should be disabled and an alternative method such as SimpleCronClone should be used.

Cartograph maps working with new Region as of v2.8 . You must update to the new Cartograph G found here:

http://www.minecraft...it=Cartograph+G

New Feature! Option to backup entire Minecraft Server directory, and the option to upload backup to remote FTP.

I took MonkeyDKS' autobackup script and modified it heavily to add new features, options, and Easy integration for any windows based Minecraft server.

The original by MonkeyDKS can be found here:

http://www.minecraft...hp?f=10&t=25967

    Main Purposes:
    Full Backups:
  • Copies the world directory of your Minecraft Server and Server files to a temp directory and compresses it using 7-zip or winrar (your choice) to a time stamped archive. Temp directory is then Deleted
    Incremental Backups:
  • Copies the world directory of your Minecraft Server and Server files to a cache directory.
  • Compresses (7-zip required) one Master file that is then used for incremental backups.
  • Each initial run of the Script creates a dated folder to store a 'Master'
  • Following Passes copy only changed files to cache directory.
  • Updated Cache files are compressed and added to a separate dated/numbered archive in dated folder where master is contained.
  • If restored backup detected, the cache is deleted and updated. A new dated folder will then be made.
  • Restore Script included to making restoring to any backup time/date easy as entering a few paths.
    Options:
  • Option to connect to remote game host via ftp and download the server. Then regular backup/mapping is performed.
  • Option to use Cartograph G to create world images of each backup.
  • Option to use included VBS Script to force server to save-all before backup.
  • Option to use Brownan's Minecraft-Overviewer for very high quality zoom-able image of world.
  • Option to use WinSCP to upload Overviewer map to remote webserver via FTP
  • Option to Backup ENTIRE Minecraft Server directory or exclude certain files
  • Option to upload backup to remote FTP
    Required Applications:
  • rar.exe from winrar or 7z.exe from 7-zip (7-zip REQUIRED for Incremental Backups)
    7-zip is open source and can be found here:
    http://www.7-zip.org/
    Optional Applications:
  • Cartograph G if wanting the world image feature.
  • MS Visual C++ 2010 Redistributable Package (x86) if using Cartograph G
    Both can be found here:
    http://www.minecraft...it=Cartograph+G
  • Overviewer if wanting very zoom-able HQ map of world. http://github.com/br...raft-Overviewer
  • Overviewer example: http://minecraft.map.gamercide.org/
  • WinSCP for Remote server retrieval, FTP Backup, and FTP upload of Overviewer http://winscp.net
  • Sleep.exe for timer. Not required but it is an option if not wanting to use ping for timing
    Found here:
    http://www.computerhope.com/dutil.htm
  • Included VBS Script if you want to use the forced server save-all

Full or incremental backups?

Full backups will copy your entire minecraft world to a temporary directory and fully compress it EVERY time the backup runs.

Incremental backups will copy the world the first time and compress to a cache directory. A folder is created every time on the initial run of the backup with a master 7z (full initial backup) . Each pass of the backup then creates compressed archives with ONLY the updated/changed portions of the world. This makes the backup process MUCH faster and takes far less overall space. The down side is the files are dependent on each other. You CANNOT delete certain backups in the folder or you risk losing parts of the world on restore. Folders however are not dependent on one another.

The other thing you MUST watch for is manually changing the world directory. If you modify it to older files etc then you should delete the cache before running the backup script again. Backups created with the incremental backup script will place a folder in the world directory that is checked for. If found the script will automatically clear the cache for you. You should only need to clear the cache if you change something manually or roll back to a backup not created with the incremental backup script.

Installation Instructions:

Download batch and vbs script from here:

http://www.gamercide...ckuppackage.zip

Or copy the script from the bottom of this post and enter into your own batch and vbs files.

Extract the Files to wherever you wish to keep them.

Next open the batch file with a txt editor and scroll to the User Variables section.

Each option has instructions above it. Basically you set the path to the files and whether or not you want to use the included options or not.

::-----------------------------------------------------------------------------------::
::----------------User Variables - Change these to fit your situation----------------::
::-----------------------------------------------------------------------------------::

::Set to use Incremental Backup. Only supports 7zip compression method. (yes or no)
::Incremental will create one base file and then only the changed updates from that point forward in 7-zip format.
::In order to restore the world you MUST extract the base file and then the changes in order until the date/time you wish to restore is reached.
SET UseIncr=no

::Set to the number of Incremental Backups you would like created before a new folder and master file is created.
::If you multiply this number by your backup Time you will get the amount of time between new incremental folder creation.
::ie. Backup time of 10 minutes, and an Incremental Backup # of 6 would create a new master and folder every 60 minutes.
SET IncrCounterMax=144

::Set Server Directory (The folder your "World" folder lives in...NOT the path inside your world folder)
SET WorldDIR=C:\Minecraft_Server

::Set World Name (Copy your World Folder name here)
SET WorldNAM=gamercide

::Set Backup Directory (Where do you want to save your backups?)
::Note! You CANNOT use your WorldDIR ( Server directory ) for backup location if using BackupALL!
::Xcopy errors out because it won't let you copy a folder and all subdirectories to a subdirectory of that folder!
SET BackupDIR=G:\minecraft backup

::Set Time between Backups (in minutes)
SET Timer=10

::Set Compression Method (rar or 7zip)
SET Method=7zip

::Set Directory for 7z.exe
SET _7zipdir=C:\Program Files\7-Zip

::Set the format you would like the date to appear on backup files. Default is year(%%g)-month(%%e)-day(%%f). Your windows time format may differ.
:: If it does or you would like something different then rearrange the parameters below until satisfied. Results will be format1-format2-format3
SET dateformat1=%%g
SET dateformat2=%%e
SET dateformat3=%%f

::You now have the option to backup your ENTIRE Minecraft Server Directory.
::All files will be found in your BackupDIR under the chosen WorldNAM ( Including the world itself ).
::Would you like to backup the entire Minecraft Server Directory? (yes or no)
SET BackupAll=no

::If you chose to Backup your Entire Server directory then you can use the exclude file to not backup certain files/folders.
::Would you like to exclude some of the files or folders? (yes or no)
SET UseExcl=no

::Set the path and filename of the file containing a list of files you would like to exclude.
::Must use FULL PATH TO FILE! If you fail to do so, backup will fail.
::Each excluded item should be on a seperate line.
::Filetypes and directoreis are accepted ie. .jar \world\
SET excludefile=C:\Minecraft_Server\exclude.txt

::Would you like to use the VBS file to force a save-all to your server? yes or no
::If you are retrieving your files from a Remote server you should set this to no.
::You will need to use a local server script to save-all such as SimpleCronClone.
SET UseVBS=yes

::Set directory where saveall.vbs is located
SET VBSDir=C:\MineCraft_Server

::Set how long you would like to wait for Minecraft Server to finish save-all before backing up.
::Maps with lots of players and changes occuring will need more time than maps
::with only a few players and changes. (Time in Seconds, 0 to start immediately)
SET VBSDelay=5

::Will you be using Sleep.exe? (yes or no)
SET UseSleep=no

::Set Sleep EXE directory if using Sleep.exe
SET SleepExe=C:\windows\system32

::Would you like to use Cartographer to map your backups? yes or no
SET UseCart=no

::Set directory where Cartograph_G_Renderer.exe is located
SET CartDIR=C:\Minecraft_Server\Cartographer

::Set the directory where you would like the maps output to. Default is your Backup directory.
SET CartOutputDIR=%BackupDIR%

::Set Cartograph G map type. Refer to Cartograph G Readme.txt for more info or leave at default setting.
::Note that the old Cartograph defaulted east as up. If you wish to keep this, change north to east.
SET CartMap=normal day north

::Set how often you would like Cartograph G to be ran. (in minutes) Minimum is the time between backups.
::Will only be ran when a backup runs. ie. If your backup time is every 30 minutes, then Cartograph
::can be set to run every 30 minutes, 1 hour, 1 hour and 30 minutes, 2 hours, etc.
::Odd times will round forward, running after the time has been met but not until the backup starts.
::Time can be different from Overviewer Time.
SET CartTimer=240

::Set to 0 if you DON'T want Cartograph to run when the batch file is initially opened.
SET CartFirstRun=1

::Would you like to use Overviewer to map your backups? First run can take a LONG time. (yes or no)
SET UseOVWR=no

::Which method of Overviewer? Windows Executable or Python Script? (exe or python)
::If using Python you must have your python directory listed in the windows PATH variable.
::Howto available here: http://docs.python.org/faq/windows.html
SET OVWRmethod=exe

::Set directory where Overviewer is located
SET OVWRDIR=C:\Minecraft_Server\Overviewer

::Set Overviewer Image Directory (Overviewer Output)
SET OVWROUTDIR=G:\minecraft backup\overviewer map

::Set Overviwer options. Render normal, lighting, night, or spawn. (refer to Overviewer readme for additional parameters)
::https://github.com/brownan/Minecraft-Overviewer/wiki/DTT-Upgrade-Guide
::rendermodes supports Multilayer Rendering. ie --rendermodes=normal,lighting,night,spawn
SET OVWROPTIONS=--processes=4 --rendermodes=normal

::Set how often you would like Overviewer to be ran. (in minutes) Minimum is the time between backups.
::Will only be ran when a backup runs. ie. If your backup time is every 30 minutes, then Overviewer
::can be set to run every 30 minutes, 1 hour, 1 hour and 30 minutes, 2 hours, etc.
::Odd times will round forward, running after the time has been met but not until the backup starts.
::Time can be different from Cartograph Time.
SET OVWRTimer=480

::Set to 0 if you DON'T want Overviwer to run when the batch file is initially opened.
SET OVWRFirstRun=1

::------------FTP OPTIONS------------------------::

::WinSCP is required if using FTP. Please set the path to WinSCP
SET ftpwinscpdir=C:\program files (x86)\winscp

::-------Start Retrieve Server Files from FTP Options-------::

::Would you like to backup a remote server? This will download the entire server to your local machine and then run the backup process. ( yes or no )
::The files will be downloaded to your WorldDir Folder then backed up like normal.
::This option is used to backup and run mapping scripts on server hosts that don't allow the option.
::If you use this option you should disable the VBS Script as it will have no effect on your remote server.
SET GetRemoteServerFiles=no

::If there are files or directories you wish to exclude from syncing on the remote server enter them here.
::Useful if doing a full backup and don't want certain files downloaded.
::Can use wild cards and directories. Comma seperated
::Refer to http://winscp.net/eng/docs/file_mask for details
::EXAMPLE::
::SET RemoteServerExclude=*.jar,directory1/,myfile.txt
SET RemoteServerExclude=

::This option allows you to use a preset session from the GUI to connect to the FTP server. I added this because this is the only way to correct
::for time zone offset with WinSCP. If your server time is different from your local time you must create a session and correct it!
::If set to yes the protocol, switch, port, name, and pass below are ignored. (yes or no)
SET UseSession=no

::If UseSession is set to yes you must enter the name of the session here.
SET Session=MinecraftFTP

::Set your ftp Protocol (ftp or sftp or scp)
SET hostftpprotocol=ftp

::This is where you can set WinSCP switches for connecting. Refer to http://winscp.net/eng/docs/script_commands#open for details.
::Main uses are to leave blank for default OR -passive for ftp protocol passive mode.
SET hostftpswitch=

::Set your ftp address here WITHOUT ftp:// (site:port)
SET hostftpurlport=yourftp.com:21

::Set the login name for your FTP.
SET hostftploginname=yourftploginname

::Set the password for your FTP.
SET hostftploginpass=yourftppass

::Set the max Download bandwidth you want WinSCP to use (kibps)
SET hostftpspeed=600

::Set your REMOTE ftp directory for retrieving the server. This needs to point to your base server directory.
::Where mincraft_server.jar is located. (Full Remote Path, no trailing slash)
SET hostftpdirectory=/xenonservers/SERVER_PORT/minecraft_server

::-------End Retrieve Server Files from FTP Options-------::

::-------Start Backup Files to FTP Options-------::

::Would you like to use WinSCP FTP to upload the Minecraft Server backup files to a web server? (yes or no)
::If connecting to a secure ftp the first run will ask you to save the key to cache.
::Once saved it will run automatically without user input from that point on.
:: If yes, please enter all the ftp information in 'Backup Files to FTP Options'
SET useftp=no

::Set your ftp Protocol (ftp or sftp or scp)
SET ftpprotocol=ftp

::This is where you can set WinSCP switches for connecting. Refer to http://winscp.net/eng/docs/script_commands#open for details.
::Main uses are to leave blank for default OR -passive for ftp protocol passive mode.
SET ftpswitch=

::Set your ftp address here WITHOUT ftp:// (site:port)
SET ftpurlport=yourftp.com:21

::Set the login name for your FTP.
SET ftploginname=yourftploginname

::Set the password for your FTP.
SET ftploginpass=yourftppass

::Set the max upload bandwidth you want WinSCP to use (kibps)
SET ftpspeed=60

::Set your REMOTE ftp directory for placing the backup files. (Full Remote Path)
SET ftpdirectory=/home/WWW/backup/minecraft

::-------End Backup Files to FTP Options------::

::-------Start Overviewer Map FTP Options-----::

::Would you like to use WinSCP FTP to upload the Overviewer map to a web server? (yes or no)
::If connecting to a secure ftp the first run will ask you to save the key to cache.
::Once saved it will run automatically without user input from that point on.
:: If yes, please refer to 'Overviewer Map FTP Options' below
SET OVWRuseftp=no

::Set your ftp Protocol (ftp or sftp or scp)
SET OVWRftpprotocol=ftp

::This is where you can set WinSCP switches for connecting. Refer to http://winscp.net/eng/docs/script_commands#open for details.
::Main uses are to leave blank for default OR -passive for ftp protocol passive mode.
SET OVWRftpswitch=

::Set your ftp address here WITHOUT ftp:// (site:port)
SET OVWRftpurlport=yourftp.com:21

::Set the login name for your FTP.
SET OVWRftploginname=yourftploginname

::Set the password for your FTP.
SET OVWRftploginpass=yourftppass

::Set the max upload bandwidth you want WinSCP to use (kibps)
SET OVWRftpspeed=60

::Set your REMOTE ftp directory for Overviewer. Should be base directory containing index.html. (Full Remote Path)
SET OVWRftpdirectory=/home/WWW/minecraft

::-------End Overviewer Map FTP Options-----::

If performing a REMOTE Server Backup Make sure the variable GetRemoteServerFiles is set to yes and all the Retrieve Server Files from FTP Options have been properly set. Also, make sure WinSCP is installed and the path is set in your variables.

Also, you will not use the VBS Script when backing up a remote server because it will have no effect. Instead you will want to install SimpleCronClone and using the two scripts I included have it run save-all every X minutes. You will want to force your server to save a few minutes more often then you backup. So, if you are backing up every 10 minutes, then force save every 7. It's not the best solution, but the only one available for remote backup atm.

Now, if performing full backups:

Be sure you have changed the UseIncr variable to no in the User Variables section.

If using WinRAR:

Place rar.exe (found in the winrar install directory) into the folder you set as your BackupDIR. WinRAR is required to be in the backup directory. If not found the batch file will notify you. You will need to place it in the directory and then restart.

If using 7zip:

You should have set the path to 7z.exe in the User variables directory. If not found you will be notified and the script will end. Set the correct path and restart.

If performing Incremental backups:

You should set the path to 7z.exe in the User variables section. 7-zip is the only method supported for incremental backups. It is freely available @ http://www.7-zip.org/ .

If not using Overviewer, Cartograph or the VBS Script to force save before backup then you are good to go and can execute the backup. It will run the backup every X minutes depending on your settings.

If using Overviewer: Install Overviewer and change the appropriate options in the batch file. Same goes for FTP upload.

If using Cartograph G: you simply have to download it and place it in the directory you choose and change the appropriate options in the batch file.

To use the VBS Script: you have to go a little more in depth. First you need to find the window name of your minecraft server. The default if using the GUI is Minecraft Server .

If different from Minecraft Server then open the saveall.vbs with a text editor and enter the name of your server window bewtween the quotes.

example:

'Enter the name of your Server Window Here bewteen the apostrophies
T1 = "My New Window Name goes here"

Save the file and then follow these next instructions carefully. If using the GUI, the command line box must be selected and ready for txt imput BEFORE navigating away from it.

If using gui or just command prompt avoid opening any other windows with the same name. GUI and command line name sharing is fine because the command can be entered into either one. Neither window has to stay in focus, but the GUI MUST have the command line box in focus before navigating away from it to work.

Once the vbs is setup correctly, simple edit the appropriate options in the batch file for using it.

Run the backup and enjoy!

Note, Cartographer, Overviewer, FTP, and forced save-all are OPTIONAL. This can be used as a simple archived backup just by turning those options off.

Included in the package is the MCRestore.bat to easily restore incremental backups. Use this when needing to restore a backup created incrementally. It is very self explanatory. You can run it without modifying the batch, but there are a few paths you may want to set so you don't have to enter them everytime.

DO NOT delete individual incremental backup files. They are dependent on one another so all files in the created folder are necessary.

MCBackup.bat:

http://www.gamercide...up/MCBackup.zip

@ECHO OFF
title Minecraft AutoBackup Utility
::By Dateranoth - August 28, 2010
::Addition of Overviwer thanks to instinx
::Timer Script, Variables and base idea thanks to MonkeyDKS
::Original AutoBackup by MonkeyDKS found here-
::http://www.minecraftforum.net/viewtopic.php?f=10&t=25967
::Used by http://www.gamercide.org on their server.
::Feel free to change, adapt, and distribute
::Download packaged backup and restore batch, and vbs script file here-
::http://www.dateranoth.com/gamercide/mcbackuppackage.zip

::V1.0-This backup utility prefers you have Sleep EXE available at this website--------::
::----http://www.computerhope.com/dutil.htm - However, this is not a necessary file.---::
::-------------------------------------------------------------------------------------::
::----Either winrar or 7-zip archiving files - 7z.exe or rar.exe are required!---------::
::----Place either 7z.exe or rar.exe In the Backup Directory That you set below.-------::
::-------------------------------------------------------------------------------------::
::----7zip is a free utility found here - http://www.7-zip.org/ -----------------------::
::----The 7z.exe will be located in the directory you installed 7-zip to.--------------::
::-------------------------------------------------------------------------------------::

::V1.1-Added ability to use Cartographer to generate map images for each backup--------::
::----Cartographer can be found here:--------------------------------------------------::
::----http://www.minecraftforum.net/viewtopic.php?f=25&t=13134-------------------------::
::-------------------------------------------------------------------------------------::

::V1.2-Added VBS Script file to force save-all before backup---------------------------::
::----VBS Script can be downloaded @ http://www.dateranoth.com/gamercide/saveall.zip----::
::-------------------------------------------------------------------------------------::

::V1.3-Added delay before execution of Cartograph do to lock ups when starting too fast::
::----Added check for temporary folder before backup starts. Will remove the folder----::
::----if found in case of mid backup crashes, etc.-------------------------------------::
::----Fixed comment lines and added comments to each section. Changed some formatting--::
::-------------------------------------------------------------------------------------::

::V1.4-Added check for temporary file that was locking up Cartograph-------------------::
::----If found, deletes tmp file before running Cartograph-----------------------------::
::----Previous timer for Cartograph reduced. Lock ups were probably the temp file the--::
::----entire time. Timer left in for a just in case measure---------------------------::
::----Added line in Variable to change the map type that Cartograph creates------------::
::----Will need to refer to Cartograph Readme.txt for options otherwise set to normal--::
::-------------------------------------------------------------------------------------::

::V1.5-Added Minecraft Overviewer Option for mapping-----------------------------------::
::----Edited by instinx - smithtec(AT)gmail.com----------------------------------------::
::----October 6th, 2010 - Added Option for using Minecraft Overviewer------------------::
::----http://github.com/brownan/Minecraft-Overviewer-----------------------------------::

::V1.6-Cleaned up a lot of code. Added option to only run Overviewer after a certain----::
::-----amount of time. Instructions for Overviewer found in User Variables-------------::

::V1.7-Added ability to use WinSCP FTP to upload Overviewer map to remote website-------::
::-----Runs a Synchronize command so only files that have changed will be uploaded------::
::-----Also cleaned up some more code and rearranged User Variables.--------------------::
::-----Download WinSCP Here: http://winscp.net : Required for FTP Upload but Free App---::

::V1.8-MAJOR UPDATE! Added option to use Incremental Updates. Incremental updates-----::
::-----greatly reduce total backup time and space. Incremental updates store one master::
::-----backup file in a dated directory. Then dated incremental updates of only changes::
::-----are produced on the next backup run. The very first run will create Cache files-::
::-----of both the world directory and the compressed backup in your backup directory.--::
::-----They will be used to produce incremental updates without recopying the full world::
::-----directory or recompressing the full directory. They will only be deleted if the-::
::-----backup script detectes a restored backup. This is done by a folder named--------::
::-----_IncrBackupRestored being created in the archives. If you restore a backup it----::
::-----will be placed in your world folder so the backup script will know to purge the--::
::-----cache. Otherwise you can manually delete the files in IncrBackupCache to force--::
::-----what is basically a full backup to be done. I'm working on a simple restore-----::
::-----script, but for now you must first extract the IncrMaster_Worldname.7z and then--::
::-----extract, in order overwriting existing files the incr_# until you get to the time::
::-----you wish to restore. Everytime you restart the script or restore a backup a new-::
::-----dated folder is created with a new master and it's own set of incremental backups::
::-----**************************IMPORTANT READ BELOW****************************-------::
::-----WinRAR is NOT SUPPORTED FOR INCREMENTAL BACKUPS. You must use the 7-zip method.-::
::-----With the addition of Incremental backup 7z.exe is no longer REQUIRED to be in----::
::-----the backup directory, but there now is an option to set the path to the exe------::
::-----This must be set for either FULL or INCREMENTAL backups to work------------------::
::-----**************************************************************************-------::
::-----Additionally I added the option to change how often Cartograph runs, and---------::
::-----rearranged some of the code for a smoother script. Along with modifications to---::
::-----check for winrar methods and notify user that Incremental backups are not--------::
::-----Supported for WinRAR. 7-ZIP is a free program so RAR support seemed uneccessary-::

::V1.9-Name Changed from SMPBackup to MCBackup. The backup package now includes a------::
::-----script to easily and quickly restore backups. Refer to it for directions.-------::
::-----http://www.dateranoth.com/gamercide/MCRestore.zip--------------------------------::

::V2.0-Modified the way batch captures time/date from system. Added the ability to-----::
::-----change the date format. Refer to User Variables for more information------------::

::V2.1-Added a max incremental count. This counter will create X number of incremental-::
::-----backups before starting a new folder and master file. This is so users who use--::
::-----regular incremental backups can create a new master folder daily or whenever.----::
::-----Which will in turn make restoring much easier and faster. If you do not wish to--::
::-----use the feature then set it to a very high number. ie. 9999999-------------------::

::V2.2-Added option to change ftp protocol when uploading Overviewer map----------------::
::-----Also, note that yes/no variables are case sensitive. They need to be lowercase---::

::V2.3-Added option to set ftp open Switches. Useful for enabling -passive mode in ftp--::
::-----Also made yes/no variables case insensitive. Case no longer matters.------------::

::V2.4-Added double quotes around FTP usernames and passwords. Common @ symbols in-----::
::-----user names were messing up the script. Should work with these now. Added option-::
::-----to wait for X seconds before running backup after server save-all. This will-----::
::-----make sure servers with lots of changes have time to finish saving before the-----::
::-----files are copied and compressed.-------------------------------------------------::

::V2.5-Added backup of Minecraft Server directory files. Only the files, and not the---::
::-----directories in your Server Directory will be copied into the backup world in a---::
::-----folder call _ServerFiles. This way you will have the configs if you have a crash::
::-----or need to restore when using mods/etc. There is also the option to use an------::
::-----exclude file. This file contains files or filetypes (one per line) that you-----::
::-----don't wish to have backed up. I have included a default one that skips .jar .bat::
::-----and .vbs. You can choose to use it or not. Default is to back up all files.----::

::V2.6-Added backup of entire Minecraft Server Directory. Refer to Variables below for -::
::-----options an instructions. Also added option to upload backups to FTP directory.--::
::-----These have been completely seperated in case overviewer and your other backups---::
::-----reside one two different servers. Refer to the variables for instructions.------::

::V2.7-Fixed Incremental FTP uploads. The ftp folder is now successfully created.------::
::-----Allowing ftp backup to work as it should for incremental backups. Also fixed----::
::-----remote backup directory option. Wasn't placing backup in correct directory.-----::
::-----If using FTP upload of backup, incremental backups with a very large max is------::
::-----recommended. This way the first backup will be large and take time uploading----::
::-----but the following incremental backups will be much smaller and save time and-----::
::-----bandwidth.-----------------------------------------------------------------------::

::V2.8-Updated saveall.vbs to V1.2 - Condensed Keystroke Commands & Added Server--------::
::-----Backup notification. Download at www.gamercide.org/minecraft/MCBackup/saveall.zip::
::-----Change Cartograph to Cartograph G to support the new save format. Can be found at::
::-----http://www.minecraftforum.net/viewtopic.php?f=1022&t=165779&hilit=Cartograph+G --::
::-----Please refer to Readme.txt included with Cartograph G for map render settings----::
::-----Added option to change output directory of the Cart maps. Default is BackupDIR---::

::V2.9-Updated Incremental backup code for 7zip. It should have been placing the-------::
::-----temporary file when updating the backup in the same directory but it wasn't.-----::
::-----Added command line to force temp files to goto backup directory so people running::
::-----on RAMDisks or low disk space won't encounter errors.----------------------------::
::-----INFORMATION UPDATE: PLEASE READ: Regards Backuping up Entire Server and Python---::
::-----If backing up your entire server directory you CANNOT place the backup location--::
::-----inside your Server Directory. This creates a loop that xcopy won't allow and----::
::-----thus fails to create the backup.-------------------------------------------------::
::-----Second, if you use overviewer and Python you MUST have your Python Directory in--::
::-----your windows PATH environment. Instructions can be found here:------------------::
::-----http://docs.python.org/faq/windows.html------------------------------------------::

::V3.0-Now supporting retrieval and backup of a remote server via ftp. If you are------::
::-----using a server host such as xenonservers.com and you need a way to backup your---::
::-----server and run the mapping tools you now have a solution. As long as you have a-::
::-----machine that can run this script you can pull the remote server files, via ftp---::
::-----run the backup and mapping, and upload the map to the webserver. The process----::
::-----treats the remote files just like you were hosting it locally and supports all---::
::-----features EXCEPT save-all. You will need to run a plugin such as SimpleCronClone-::
::-----to force save-all ever X minutes ahead of when this script is going to run-------::
::-----My latest release will include the two .scc scripts needed to do this. You will-::
::-----need to download and install the plugin however.---------------------------------::
::-----The option to do remote retrieval can be found under FTP Options-----------------::
::-----The only other change is that the xcopy exclude file MUST have the full path-----::
::-----if being used. Example below.---------------------------------------------------::

::V3.1-The older versions of Overviewer have been dropped. Only the Direct to Tile-----::
::-----version is supported now. It can be found at the link below---------------------::
::-----https://github.com/brownan/Minecraft-Overviewer/tree/dtt-c-render----------------::
::-----If you are using an older version of Overviewer it will still work but you'll----::
::-----need to change gmap.py or gmap.exe to overviewer.py or overviewer.exe.-----------::
::-----You will also have to change the OVWROPTION sections below to comply with the old::
::-----Overviewer settings.-------------------------------------------------------------::
::-----Finally, I have added an option to the Remote Server Download. This option------::
::-----will allow you to open sessions saved in WinSCP, which is useful for syncing the-::
::-----server time zone with your local computer. If you do not then the files will not-::
::-----sync properly. Refer to the WinSCP website for instructions on the time offset.-::

::-----------------------------------------------------------------------------------::
::----------------User Variables - Change these to fit your situation----------------::
::-----------------------------------------------------------------------------------::

::Set to use Incremental Backup. Only supports 7zip compression method. (yes or no)
::Incremental will create one base file and then only the changed updates from that point forward in 7-zip format.
::In order to restore the world you MUST extract the base file and then the changes in order until the date/time you wish to restore is reached.
SET UseIncr=no

::Set to the number of Incremental Backups you would like created before a new folder and master file is created.
::If you multiply this number by your backup Time you will get the amount of time between new incremental folder creation.
::ie. Backup time of 10 minutes, and an Incremental Backup # of 6 would create a new master and folder every 60 minutes.
SET IncrCounterMax=144

::Set Server Directory (The folder your "World" folder lives in...NOT the path inside your world folder)
SET WorldDIR=C:\Minecraft_Server

::Set World Name (Copy your World Folder name here)
SET WorldNAM=gamercide

::Set Backup Directory (Where do you want to save your backups?)
::Note! You CANNOT use your WorldDIR ( Server directory ) for backup location if using BackupALL!
::Xcopy errors out because it won't let you copy a folder and all subdirectories to a subdirectory of that folder!
SET BackupDIR=G:\minecraft backup

::Set Time between Backups (in minutes)
SET Timer=10

::Set Compression Method (rar or 7zip)
SET Method=7zip

::Set Directory for 7z.exe
SET _7zipdir=C:\Program Files\7-Zip

::Set the format you would like the date to appear on backup files. Default is year(%%g)-month(%%e)-day(%%f). Your windows time format may differ.
:: If it does or you would like something different then rearrange the parameters below until satisfied. Results will be format1-format2-format3
SET dateformat1=%%g
SET dateformat2=%%e
SET dateformat3=%%f

::You now have the option to backup your ENTIRE Minecraft Server Directory.
::All files will be found in your BackupDIR under the chosen WorldNAM ( Including the world itself ).
::Would you like to backup the entire Minecraft Server Directory? (yes or no)
SET BackupAll=no

::If you chose to Backup your Entire Server directory then you can use the exclude file to not backup certain files/folders.
::Would you like to exclude some of the files or folders? (yes or no)
SET UseExcl=no

::Set the path and filename of the file containing a list of files you would like to exclude.
::Must use FULL PATH TO FILE! If you fail to do so, backup will fail.
::Each excluded item should be on a seperate line.
::Filetypes and directoreis are accepted ie. .jar \world\
SET excludefile=C:\Minecraft_Server\exclude.txt

::Would you like to use the VBS file to force a save-all to your server? yes or no
::If you are retrieving your files from a Remote server you should set this to no.
::You will need to use a local server script to save-all such as SimpleCronClone.
SET UseVBS=yes

::Set directory where saveall.vbs is located
SET VBSDir=C:\MineCraft_Server

::Set how long you would like to wait for Minecraft Server to finish save-all before backing up.
::Maps with lots of players and changes occuring will need more time than maps
::with only a few players and changes. (Time in Seconds, 0 to start immediately)
SET VBSDelay=5

::Will you be using Sleep.exe? (yes or no)
SET UseSleep=no

::Set Sleep EXE directory if using Sleep.exe
SET SleepExe=C:\windows\system32

::Would you like to use Cartographer to map your backups? yes or no
SET UseCart=no

::Set directory where Cartograph_G_Renderer.exe is located
SET CartDIR=C:\Minecraft_Server\Cartographer

::Set the directory where you would like the maps output to. Default is your Backup directory.
SET CartOutputDIR=%BackupDIR%

::Set Cartograph G map type. Refer to Cartograph G Readme.txt for more info or leave at default setting.
::Note that the old Cartograph defaulted east as up. If you wish to keep this, change north to east.
SET CartMap=normal day north

::Set how often you would like Cartograph G to be ran. (in minutes) Minimum is the time between backups.
::Will only be ran when a backup runs. ie. If your backup time is every 30 minutes, then Cartograph
::can be set to run every 30 minutes, 1 hour, 1 hour and 30 minutes, 2 hours, etc.
::Odd times will round forward, running after the time has been met but not until the backup starts.
::Time can be different from Overviewer Time.
SET CartTimer=240

::Set to 0 if you DON'T want Cartograph to run when the batch file is initially opened.
SET CartFirstRun=1

::Would you like to use Overviewer to map your backups? First run can take a LONG time. (yes or no)
SET UseOVWR=no

::Which method of Overviewer? Windows Executable or Python Script? (exe or python)
::If using Python you must have your python directory listed in the windows PATH variable.
::Howto available here: http://docs.python.org/faq/windows.html
SET OVWRmethod=exe

::Set directory where Overviewer is located
SET OVWRDIR=C:\Minecraft_Server\Overviewer

::Set Overviewer Image Directory (Overviewer Output)
SET OVWROUTDIR=G:\minecraft backup\overviewer map

::Set Overviwer options. Render normal, lighting, night, or spawn. (refer to Overviewer readme for additional parameters)
::https://github.com/brownan/Minecraft-Overviewer/wiki/DTT-Upgrade-Guide
::rendermodes supports Multilayer Rendering. ie --rendermodes=normal,lighting,night,spawn
SET OVWROPTIONS=--processes=4 --rendermodes=normal

::Set how often you would like Overviewer to be ran. (in minutes) Minimum is the time between backups.
::Will only be ran when a backup runs. ie. If your backup time is every 30 minutes, then Overviewer
::can be set to run every 30 minutes, 1 hour, 1 hour and 30 minutes, 2 hours, etc.
::Odd times will round forward, running after the time has been met but not until the backup starts.
::Time can be different from Cartograph Time.
SET OVWRTimer=480

::Set to 0 if you DON'T want Overviwer to run when the batch file is initially opened.
SET OVWRFirstRun=1

::------------FTP OPTIONS------------------------::

::WinSCP is required if using FTP. Please set the path to WinSCP
SET ftpwinscpdir=C:\program files (x86)\winscp

::-------Start Retrieve Server Files from FTP Options-------::

::Would you like to backup a remote server? This will download the entire server to your local machine and then run the backup process. ( yes or no )
::The files will be downloaded to your WorldDir Folder then backed up like normal.
::This option is used to backup and run mapping scripts on server hosts that don't allow the option.
::If you use this option you should disable the VBS Script as it will have no effect on your remote server.
SET GetRemoteServerFiles=no

::If there are files or directories you wish to exclude from syncing on the remote server enter them here.
::Useful if doing a full backup and don't want certain files downloaded.
::Can use wild cards and directories. Comma seperated
::Refer to http://winscp.net/eng/docs/file_mask for details
::EXAMPLE::
::SET RemoteServerExclude=*.jar,directory1/,myfile.txt
SET RemoteServerExclude=

::This option allows you to use a preset session from the GUI to connect to the FTP server. I added this because this is the only way to correct
::for time zone offset with WinSCP. If your server time is different from your local time you must create a session and correct it!
::If set to yes the protocol, switch, port, name, and pass below are ignored. (yes or no)
SET UseSession=no

::If UseSession is set to yes you must enter the name of the session here.
SET Session=MinecraftFTP

::Set your ftp Protocol (ftp or sftp or scp)
SET hostftpprotocol=ftp

::This is where you can set WinSCP switches for connecting. Refer to http://winscp.net/eng/docs/script_commands#open for details.
::Main uses are to leave blank for default OR -passive for ftp protocol passive mode.
SET hostftpswitch=

::Set your ftp address here WITHOUT ftp:// (site:port)
SET hostftpurlport=yourftp.com:21

::Set the login name for your FTP.
SET hostftploginname=yourftploginname

::Set the password for your FTP.
SET hostftploginpass=yourftppass

::Set the max Download bandwidth you want WinSCP to use (kibps)
SET hostftpspeed=600

::Set your REMOTE ftp directory for retrieving the server. This needs to point to your base server directory.
::Where mincraft_server.jar is located. (Full Remote Path, no trailing slash)
SET hostftpdirectory=/xenonservers/SERVER_PORT/minecraft_server

::-------End Retrieve Server Files from FTP Options-------::

::-------Start Backup Files to FTP Options-------::

::Would you like to use WinSCP FTP to upload the Minecraft Server backup files to a web server? (yes or no)
::If connecting to a secure ftp the first run will ask you to save the key to cache.
::Once saved it will run automatically without user input from that point on.
:: If yes, please enter all the ftp information in 'Backup Files to FTP Options'
SET useftp=no

::Set your ftp Protocol (ftp or sftp or scp)
SET ftpprotocol=ftp

::This is where you can set WinSCP switches for connecting. Refer to http://winscp.net/eng/docs/script_commands#open for details.
::Main uses are to leave blank for default OR -passive for ftp protocol passive mode.
SET ftpswitch=

::Set your ftp address here WITHOUT ftp:// (site:port)
SET ftpurlport=yourftp.com:21

::Set the login name for your FTP.
SET ftploginname=yourftploginname

::Set the password for your FTP.
SET ftploginpass=yourftppass

::Set the max upload bandwidth you want WinSCP to use (kibps)
SET ftpspeed=60

::Set your REMOTE ftp directory for placing the backup files. (Full Remote Path)
SET ftpdirectory=/home/WWW/backup/minecraft

::-------End Backup Files to FTP Options------::

::-------Start Overviewer Map FTP Options-----::

::Would you like to use WinSCP FTP to upload the Overviewer map to a web server? (yes or no)
::If connecting to a secure ftp the first run will ask you to save the key to cache.
::Once saved it will run automatically without user input from that point on.
:: If yes, please refer to 'Overviewer Map FTP Options' below
SET OVWRuseftp=no

::Set your ftp Protocol (ftp or sftp or scp)
SET OVWRftpprotocol=ftp

::This is where you can set WinSCP switches for connecting. Refer to http://winscp.net/eng/docs/script_commands#open for details.
::Main uses are to leave blank for default OR -passive for ftp protocol passive mode.
SET OVWRftpswitch=

::Set your ftp address here WITHOUT ftp:// (site:port)
SET OVWRftpurlport=yourftp.com:21

::Set the login name for your FTP.
SET OVWRftploginname=yourftploginname

::Set the password for your FTP.
SET OVWRftploginpass=yourftppass

::Set the max upload bandwidth you want WinSCP to use (kibps)
SET OVWRftpspeed=60

::Set your REMOTE ftp directory for Overviewer. Should be base directory containing index.html. (Full Remote Path)
SET OVWRftpdirectory=/home/WWW/minecraft

::-------End Overviewer Map FTP Options-----::


::------------------------------------------------------------------------------------------------------------------------------::

::!!!!!!!!!!!!!!!!DON'T TOUCH BELOW HERE unless you know Batch (And are willing to lower yourself to that level)!!!!!!!!!!!!!!!!::

::------------------------------------------------------------------------------------------------------------------------------::
::Set Overviewer and Cartograph Counter to 0 on first run.
SET RemainingOVWRTimer=0
SET RemainingCartTimer=0
::Set variables for Incremental backup.
SET IncrBootRun=1
SET IncrCounter=0
::Set variables for excluding files from Server Directory
IF /i %UseExcl%==yes (SET exclude=/exclude:%excludefile%) ELSE (SET exclude=)

::Below Checks to make sure the proper Method is there and the files can be located for compression. If not, stops backup before it starts.
:Methodtest
IF /i %Method%==7zip (goto 7zip) ELSE IF /i %Method%==rar (goto rar) ELSE (goto methodwrong)

::Notifies the user that an invalid compression method was selected. Then exits.
:methodwrong
ECHO You have entered an invalid Method (Currently %Method%) Must be rar or 7zip
ECHO Change the Method and then restart the batch file to continue with Backup.
pause
exit

::RAR method detected. Check to see if its FULL or INCREMENTAL backup method.
:rar
IF /i %UseIncr%==yes (goto rarINCR) ELSE (goto rarFULL)

::RAR is not supported for Incremental backups. Notify user and exit.
:rarINCR
ECHO Current method of backup is %Method% . %Method% is not supported for incremental backups.
ECHO.
ECHO Either change to 7zip method or Change to Full backups and restart script.
pause
exit

::Checks for the rar.exe before continuing with backup
:rarFULL
IF EXIST "%BackupDIR%\rar.exe". (goto start) ELSE (goto rarbad)

::Checks for the 7z.exe before continuing with backup
:7zip
IF EXIST "%_7zipdir%\7z.exe". (goto start) ELSE (goto 7zipbad)

::Notifies user that winrar was selected but no rar.exe was found.
:rarbad
Echo rar.exe not found. Please Place rar.exe in the BackupDIR (Currently: %BackupDIR%)
Echo and restart script to continue with Backup.
pause
exit

::Notifies user that 7-zip was selected but no 7z.exe was found.
:7zipbad
Echo 7z.exe not found. Current location %_7zipdir% . Please update location and restart script
Echo to continue with Backup.
pause
exit

::Resets timer and Checks for BackupMethod
:start
SET RemainingTimer=%Timer%
echo.
echo Starting Back up of MineCraft World - %WorldNam%
echo.
::If Backing up a Remote server, checks for Full backup and then retrieves files to local directory
IF /i %UseSession%==yes (SET remoteconnection=""%session%"") ELSE (SET remote connection=%hostftpprotocol%://""%hostftploginname%"":""%hostftploginpass%""@%hostftpurlport% %hostftpswitch%)
IF /i %GetRemoteServerFiles%==yes (
echo Retrieving Server Files from Remote Server.
IF /i %BackupAll%==yes (
start /wait /min /d "%ftpwinscpdir%" winscp.exe /console /command "open %remoteconnection%" "option batch continue" "option exclude "%RemoteServerExclude%"" "synchronize local -delete -criteria=both -speed=%hostftpspeed% ""%WorldDIR%"" ""%hostftpdirectory%""" "exit"
) ELSE (
start /wait /min /d "%ftpwinscpdir%" winscp.exe /console /command "open %remoteconnection%" "option batch continue" "option exclude "%RemoteServerExclude%"" "synchronize local -delete -criteria=both -speed=%hostftpspeed% ""%WorldDIR%\%WorldNam%"" ""%hostftpdirectory%/%WorldNam%""" "exit"
))
echo.
IF /i %UseIncr%==yes (goto VBScheck) ELSE (goto startfull)

::Checks for old temporary directory
:startfull
IF EXIST "%BackupDIR%\%WorldNam%\" (goto tempcleanup) ELSE (goto VBScheck)

::Removes Temporary world folder if found.
:tempcleanup
echo Old Temporary folder found.
echo Deleting Temporary Folder before backup.
rd /s/q "%BackupDIR%\%WorldNAM%"
goto VBScheck

::Checks to see if Script for forcing server save is enabled
:VBScheck
IF /i %UseVBS%==yes (goto VBS) ELSE (goto backupmethod)

::Uses VBS Script to force command input of save-all into server
:VBS
echo Forcing Server to save world
cd /d "%VBSDir%"
saveall.vbs
IF %VBSDelay% LEQ 0 (echo.) ELSE (ECHO Waiting for %VBSDelay% seconds before starting backup)
IF %VBSDelay% LEQ 0 (goto backupmethod) ELSE IF /i %UseSleep%==yes (%SleepEXE%\sleep.exe %VBSDelay%) ELSE (PING -n %VBSDelay% 127.0.0.1 >nul)
goto backupmethod

::Check to see which backup method should be used. Full or Incremental.
:backupmethod
IF /i %UseIncr%==yes (goto startincr) ELSE (goto tempcopy)

::-----------START INCREMENTAL BACKUP CODE------------------------::
::Check to see if this is the intial Incremental run.
:startincr
for /f "tokens=1-5 delims=/\ " %%d in ("%date%") do SET Date1=%dateformat1%-%dateformat2%-%dateformat3%
for /f "tokens=1-5 delims=: " %%d in ("%time%") do SET Time1=%%d%%e
SET WorldNamDate=%worldNAM%-%Date1%---%Time1%
IF %IncrBootRun%==1 (goto incrboot) ELSE IF %IncrCounter% GEQ %IncrCounterMax% (goto incrboot) ELSE IF EXIST "%WorldDIR%\%WorldNam%\_IncrBackupRestored" (goto incrboot) ELSE (goto incrpass)

::Initial Incremental run creates some folders and resets the counter for the incremental backups.
::Also runs check to see if a world backup has been restored since last run.
:incrboot
ECHO Starting Initial Run of Backup. New, dated folder will be created and Incr Backups will be stored there until Script restarted.
ECHO.
SET IncrBootRun=0
for /f "tokens=1-5 delims=/\ " %%d in ("%date%") do SET Date2=%dateformat1%-%dateformat2%-%dateformat3%
for /f "tokens=1-5 delims=: " %%d in ("%time%") do SET Time2=%%d%%e
SET WorldNamIncrDate=%worldNAM%-%Date2%---%Time2%
SET IncrCounter=1
md "%BackupDIR%\%WorldNamIncrDate%
IF EXIST "%WorldDIR%\%WorldNam%\_IncrBackupRestored" (goto incrdelworld) ELSE (goto incrfirstpass)

::This is to ensure we don't get crossed files if a backup has been restored. Removes BackupCache thus Forcing recopy of ENTIRE world directory.
::Also removes tagged folder in worlddir. Should only reappear if user restores another backup.
:incrdelworld
ECHO Restored Backup found. Must delete cache to insure proper backup.
ECHO.
rd /s/q "%BackupDIR%\IncrBackupCache\%WorldNAM%"
rd /s/q "%WorldDIR%\%WorldNam%\_IncrBackupRestored"
goto incrfirstpass

::Checks whether to backup entire server directory or just world directory and performs appropriate copy function
::First Pass will update Cached world directory and master compressed file. Also creates Master file in dated folder.
::Also creates the folder _IncrBackupRestored so it can be checked for after a restored backup.
::Checks if FTP upload is desired and uploads if so.
:incrfirstpass
ECHO This is a new run of backup script. Updating cache files and creating initial backup.
ECHO.
IF /i %BackupAll%==yes (xcopy "%WorldDIR%" "%BackupDIR%\IncrBackupCache\%WorldNam%" /E/D/I/Q/H/Y %exclude%) ELSE (xcopy "%WorldDIR%\%WorldNam%" "%BackupDIR%\IncrBackupCache\%WorldNam%" /S/I/Q/Y/D)
md "%BackupDIR%\IncrBackupCache\%WorldNam%\_IncrBackupRestored"
"%_7zipdir%\7z.exe" u "%BackupDIR%\IncrBackupCache\IncrMaster_%WorldNam%.7z" -w"%BackupDIR%\IncrBackupCache" -up0q0r2x2y2z1w2 "%BackupDIR%\IncrBackupCache\%WorldNAM%" -ms=off
xcopy "%BackupDIR%\IncrBackupCache\IncrMaster_%WorldNam%.7z" "%BackupDIR%\%WorldNamIncrDate%\" /Q/Y
IF %useftp%==yes (
cd /d "%ftpwinscpdir%"
start /wait winscp.exe /console /command "open %ftpprotocol%://""%ftploginname%"":""%ftploginpass%""@%ftpurlport% %ftpswitch%" "cd ""%ftpdirectory%/""" "mkdir ""%WorldNamIncrDate%""" "put -speed=%ftpspeed% ""%BackupDIR%\%WorldNamIncrDate%\IncrMaster_%WorldNam%.7z"" ""%ftpdirectory%/%WorldNamIncrDate%/""" "exit"
)
IF /i %UseSleep%==yes (goto mapdelaysleep) ELSE (goto mapdelayping)

::Checks whether to backup entire server directory or just world directory and performs appropriate copy function
::Passes after the first one will create Incremental files in the last dated world backup directory.
::They will only reflect changes made that differ from the Master file. Thus greatly speeding up the entire process.
::Checks if FTP upload is desired and uploads if so.
:incrpass
for /f "tokens=1-5 delims=/\ " %%d in ("%date%") do SET Date3=%dateformat1%-%dateformat2%-%dateformat3%
for /f "tokens=1-5 delims=: " %%d in ("%time%") do SET Time3=%%d%%e
SET IncrCounterDate=%IncrCounter%__%Date3%---%Time3%
ECHO Updating MineCraft world to working Directory. Only new files will be transferred.
IF /i %BackupAll%==yes (xcopy "%WorldDIR%" "%BackupDIR%\IncrBackupCache\%WorldNam%" /E/D/I/Q/H/Y %exclude%) ELSE (xcopy "%WorldDIR%\%WorldNam%" "%BackupDIR%\IncrBackupCache\%WorldNam%" /S/I/Q/Y/D)
ECHO Compressing New Files to Incr. 7z file.
"%_7zipdir%\7z.exe" u "%BackupDIR%\IncrBackupCache\IncrMaster_%WorldNam%.7z" -w"%BackupDIR%\IncrBackupCache" -up0q0r2x2y2z1w2 -up3q3r2x2y2z0w2!"%BackupDIR%\%WorldNamIncrDate%\incr_#%IncrCounterDate%.7z" "%BackupDIR%\IncrBackupCache\%WorldNam%" -ms=off
SET /a IncrCounter=IncrCounter+1
IF %useftp%==yes (
cd /d "%ftpwinscpdir%"
start /wait winscp.exe /console /command "open %ftpprotocol%://""%ftploginname%"":""%ftploginpass%""@%ftpurlport% %ftpswitch%" "put -speed=%ftpspeed% ""%BackupDIR%\%WorldNamIncrDate%\incr_#%IncrCounterDate%.7z"" ""%ftpdirectory%/%WorldNamIncrDate%/""" "exit"
)
IF /i %UseSleep%==yes (goto mapdelaysleep) ELSE (goto mapdelayping)
::------------END INCREMENTAL BACKUP CODE----------------------------::

::------------START FULL BACKUP CODE---------------------------------::
::Checks whether to backup entire server directory or just world directory and performs appropriate copy function.
::Copies the world folder from the server to a temporary directory for processing. Also Sets the backup file name.
:tempcopy
echo Copying MineCraft world to temporary working Directory
IF /i %BackupAll%==yes (xcopy "%WorldDIR%" "%BackupDIR%\%WorldNam%" /E/I/Q/H/Y %exclude%) ELSE (xcopy "%WorldDIR%\%WorldNam%" "%BackupDIR%\%WorldNam%" /S/I/Q/Y)
cd /d "%BackupDIR%"
for /f "tokens=1-5 delims=/\ " %%d in ("%date%") do SET Date1=%dateformat1%-%dateformat2%-%dateformat3%
for /f "tokens=1-5 delims=: " %%d in ("%time%") do SET Time1=%%d%%e
SET WorldNamDate=%worldNAM%-%DATE1%---%Time1%
IF /i %Method%==7zip (goto 7zipgood) ELSE IF /i %Method%==rar (goto rargood) ELSE (goto methodtest)

::7z.exe method. Compresses files then waits for 5 seconds using Sleep or Ping
::Checks whether to backup entire server directory or just world directory and performs appropriate copy function
:7zipgood
echo Compressing using 7zip
"%_7zipdir%\7z.exe" a "%BackupDIR%\%WorldNamDate%.7z" "%BackupDIR%\%WorldNAM%"
IF %useftp%==yes (
cd /d "%ftpwinscpdir%"
start /wait winscp.exe /console /command "open %ftpprotocol%://""%ftploginname%"":""%ftploginpass%""@%ftpurlport% %ftpswitch%" "put -speed=%ftpspeed% ""%BackupDIR%\%WorldNamDate%.7z"" ""%ftpdirectory%/""" "exit"
)
IF /i %UseSleep%==yes (goto mapdelaysleep) ELSE (goto mapdelayping)

::rar.exe method. Compresses files then waits for 5 seconds using Sleep or Ping
::Checks whether to backup entire server directory or just world directory and performs appropriate copy function
:rargood
cd /d "%BackupDIR%"
echo Compressing using WinRAR
rar.exe a -m5 -- "%WorldNamDate%" "%WorldNAM%"
IF %useftp%==yes (
cd /d "%ftpwinscpdir%"
start /wait winscp.exe /console /command "open %ftpprotocol%://""%ftploginname%"":""%ftploginpass%""@%ftpurlport% %ftpswitch%" "put -speed=%ftpspeed% ""%BackupDIR%\%WorldNamDate%.rar"" ""%ftpdirectory%/""" "exit"
)
IF /i %UseSleep%==yes (goto mapdelaysleep) ELSE (goto mapdelayping)
::---------------------END FULL BACKUP CODE------------------------------::


::Delay of 5 seconds added to be sure Files Copied. Sleep method
::Then checks whether to use Cartograph or Overviewer or neither
:mapdelaysleep
IF /i %UseIncr%==yes (SET TempWorld=%BackupDIR%\IncrBackupCache\%WorldNAM%) ELSE (SET TempWorld=%BackupDIR%\%WorldNAM%)
IF /i %BackupAll%==yes (SET TempWorldDir=%Tempworld%\%WorldNAM%) ELSE (SET TempWorldDir=%TempWorld%)
cd /d %SleepEXE%
sleep 5
IF /i %UseCart%==yes (goto carttimecheck) ELSE IF /i %UseOVWR%==yes (goto OVWR) ELSE (goto endbackup)

::Delay of 5 seconds added to be sure Files Copied. Ping method.
::Then checks whether to use Cartograph or Overviewer or neither
:mapdelayping
IF /i %UseIncr%==yes (SET TempWorld=%BackupDIR%\IncrBackupCache\%WorldNAM%) ELSE (SET TempWorld=%BackupDIR%\%WorldNAM%)
IF /i %BackupAll%==yes (SET TempWorldDir=%Tempworld%\%WorldNAM%) ELSE (SET TempWorldDir=%TempWorld%)
PING -n 5 127.0.0.1 >nul
IF /i %UseCart%==yes (goto carttimecheck) ELSE IF /i %UseOVWR%==yes (goto OVWR) ELSE (goto endbackup)

::Check to see if this is first run of batch file. If so, note this and then run cartograph.
::Otherwise Check to see if cartograph should be ran based on user selected time. If not, skip cartograph this run.
:carttimecheck
IF %CartFirstRun%==1 (goto cartboot) ELSE IF %RemainingCartTimer% GEQ %CartTimer% (goto cartobadfilecheck) ELSE IF /i %UseOVWR%==yes (goto OVWR) ELSE (goto endbackup)

:cartboot
SET CartFirstRun=0
goto cartobadfilecheck

::Checks for Temporary File that's been locking up Cartograph
:cartobadfilecheck
IF EXIST "%TempWorldDir%\tmp_chunk.dat" (goto deletebadfile) ELSE (goto cartostart)

::Deletes Temporary File that's been locking up Cartograph
:deletebadfile
del /f "%TempWorldDir%\tmp_chunk.dat"
echo Temporary file that causes Cartograph lockups found and deleted.
goto cartostart

::User selected to use cartograph. Runs Cartograh then checks to see if user would also like to run Overviwer.
:cartostart
echo Creating map image using Cartographer
echo Process may take a long time. Be patient.
echo.
cd /d %CartDIR%
Cartograph_G_Renderer.exe custom "%TempWorldDir%" output "%CartOutputDIR%\%WorldNamDate%.png" %CartMap%
SET RemainingCartTimer=0
IF /i %UseOVWR%==yes (goto OVWR) ELSE (goto endbackup)

::Check to see if this is first run of batch file. If so, note this and then run overviewer.
::Otherwise Check to see if overviewer should be ran based on user selected time. If not, skip overviewer this run.
:OVWR
IF %OVWRFirstRun%==1 (goto OVWRBoot) ELSE IF %RemainingOVWRTimer% GEQ %OVWRTimer% (goto OVWRStart) ELSE (goto endbackup)

:OVWRBoot
SET OVWRFirstRun=0
goto OVWRStart

::User selected to use Overviewer. Should we run the EXE or Python Version?
:OVWRStart
echo Creating map image using OverViewer
echo Process takes a very long time. Get a sandwich.
echo.
IF /i %OVWRmethod%==exe (goto OVWRexestart) ELSE IF /i %OVWRmethod%==python (goto OVWRpythonstart) ELSE (goto OVWRError)

::A method that doesn't exist was entered. We are notified and allowed to continue backup process after input.
:OVWRError
ECHO You have entered an invalid Method (Currently %OVWRmethod%) Must be exe or python
ECHO Change the Method and then restart the backup process or press enter to continue.
pause
goto endbackup

::Python method was selected. Overviewer will now be ran using the selected options. Run timer will then be reset.
:OVWRpythonstart
cd /d %OVWRDIR%
Python overviewer.py %OVWROPTIONS% "%TempWorldDir%" "%OVWROUTDIR%"
goto OVWRftpcheck

::EXE method was selected. Overviewer will now be ran using selected options. Run timer will then be reset.
:OVWRexestart
cd /d %OVWRDIR%
overviewer.exe %OVWROPTIONS% "%TempWorldDir%" "%OVWROUTDIR%"
goto OVWRftpcheck

:OVWRftpcheck
SET RemainingOVWRTimer=0
IF /i %OVWRuseftp%==yes (goto startftp) ELSE (goto endbackup)

::Attempts to kill WinSCP in case it was still running or stuck from last time.
::Starting the FTP Upload Process. It is opened as a seperate process and is not waited for because it can take a long time.
:startftp
ECHO Starting FTP Upload of Overviewer. Process will open in a new window and backup batch will continue to run without waiting.
taskkill /im winscp.exe
cd /d "%ftpwinscpdir%"
start winscp.exe /console /command "open %OVWRftpprotocol%://""%OVWRftploginname%"":""%OVWRftploginpass%""@%OVWRftpurlport% %OVWRftpswitch%" "synchronize remote -delete -criteria=both -speed=%OVWRftpspeed% ""%OVWROUTDIR%"" ""%OVWRftpdirectory%""" "exit"
goto endbackup

::All processes are complete. Check if we should delete the temporary folder or not.
:endbackup
IF /i %UseIncr%==yes (goto backupcomplete) ELSE (goto tempdelete)

::Full backups have temporary folder removed everytime.
:tempdelete
echo Deleting Temporary Folder
rd /s/q "%BackupDIR%\%WorldNAM%"
goto backupcomplete

::Notifies user backup is complete then starts Timer to next backup.
:backupcomplete
cls
IF /i %UseIncr%==yes (ECHO Incremental Backup #%IncrCounter% of %IncrCounterMax% Of) ELSE (ECHO Full Backup Of)
for /f "tokens=1-5 delims=/\ " %%d in ("%date%") do SET Date1=%dateformat1%-%dateformat2%-%dateformat3%
for /f "tokens=1-5 delims=: " %%d in ("%time%") do SET Time1=%%d%%e
ECHO %WorldNAM% COMPLETED On %Date1%---%Time1%
goto RemainingLoop

::Checks if timer has counted down to 0. If so restarts backup
:RemainingLoop
IF %RemainingTimer% gtr 0 (goto OneMoreMinuteMom) ELSE (goto Start)

::Notifies user of remaining time then checks whether to use sleep.exe or ping method.
:OneMoreMinuteMom
IF /i %UseOVWR%==yes (SET /a OVWRStatus=OVWRTimer-RemainingOVWRTimer)
IF /i %UseCart%==yes (SET /a CartStatus=CartTimer-RemainingCartTimer)
ECHO.
ECHO: %RemainingTimer% more minutes until next backup...
ECHO.
IF /i %UseOVWR%==yes (ECHO: %OVWRStatus% more minutes until next Overviewer Run...)
IF /i %UseCart%==yes (ECHO: %CartStatus% more minutes until next Cartograph Run...)
IF /i %UseSleep%==yes (goto sleeptimer) ELSE (goto pingtimer)

::Uses sleep timer to countown 60 seconds then subtracts 1 from user selected time between backup and Overviewer minutes.
:sleeptimer
cd /d %SleepEXE%
sleep 60
SET /a RemainingTimer=RemainingTimer-1
IF /i %UseOVWR%==yes (SET /a RemainingOVWRTimer=RemainingOVWRTimer+1)
IF /i %UseCart%==yes (SET /a RemainingCartTimer=RemainingCartTimer+1)
GOTO RemainingLoop

::Uses ping timer to countown 60 seconds then subtracts 1 from user selected time between backup and Overviewer minutes.
:pingtimer
PING -n 60 127.0.0.1 >nul
SET /a RemainingTimer=RemainingTimer-1
IF /i %UseOVWR%==yes (SET /a RemainingOVWRTimer=RemainingOVWRTimer+1)
IF /i %UseCart%==yes (SET /a RemainingCartTimer=RemainingCartTimer+1)
GOTO RemainingLoop

::Should never be used. Hopefully catches any errors.
:end
pause
Exit

MCRestore.bat

http://www.gamercide...p/MCRestore.zip


@ECHO OFF
Title "MC Backup Restore Script"
::By Dateranoth - October 14, 2010
::Feel free to change, adapt, and distribute
::Created for use restoring incremental backups created by MCBackup
::http://www.gamercide.org/forum/index.php?/topic/1407-minecraft-alpha-server-backup-utility/

::V1.0-Initial creation
:start
ECHO.
ECHO Starting MC Backup Restore.
ECHO.
ECHO First You will be asked to select the appropriate variables.
ECHO The below variables are directories without trailing Slashes.
ECHO After proper variables are input the script will extract the
ECHO backup to the directory you select. The Incremental backup number
ECHO you select will be the Restored date and time.
ECHO.
ECHO.
::SET _7zipdir=Uncomment this SET, Comment Out below SET and set 7zip directory here if not wanting to set it everytime.
SET /p _7zipdir="Please set the path to 7z.exe: "
ECHO.
SET /p backupdir="Please set the path to the backup directory you'd like to restore: "
ECHO.
ECHO The restore extracts the world directory as the world named folder.
ECHO ie. Setting C:\yourpath would restore to C:\yourpath\yourworldname
ECHO.
::SET extractdir=Uncomment this SET, Comment Out below SET and set extract directory here if not wanting to set it everytime
SET /p extractdir="Please set the path to the directory you would like to restore the back up to: "
ECHO.
ECHO The field entered below MUST be a number. 0 to restore only the master backup.
SET /p incrnumber="Please set the Incremental backup number you would like to restore to: "
ECHO.
ECHO.

:check1
IF EXIST "%_7zipdir%\7z.exe" (goto check2) ELSE (
ECHO.
ECHO 7z.exe cannot be found in %_7zipdir% . Please enter proper directory.
ECHO.
SET /p _7zipdir="Please set the path to 7z.exe: "
goto check1)

:check2
IF EXIST "%backupdir%\IncrMaster_*.7z" (goto allgood) ELSE (
ECHO.
ECHO IncrMaster_*.7z cannot be found in %backupdir%
ECHO Please set the directory where the master backup file is located.
ECHO.
SET /p backupdir="Please set the path to the backup directory you'd like to restore: "
goto check2)

:allgood

ECHO %_7zipdir% has been input as the directory 7z.exe is located
ECHO.
ECHO %backupdir% has been input as the directory containing the backup files.
ECHO.
ECHO %extractdir% has been input as the directory you wish to restore to.
ECHO.
IF %incrnumber%==0 (
ECHO You have selected to restore only the Master Backup file.
) ELSE (
ECHO You have selected to restore Backup #%incrnumber% .
)
ECHO.
ECHO If these variables are incorrect. Exit and restart batch. Otherwise:
ECHO WARNING. IF RESTORING TO WORLD DIRECTORY. DELETE OLD WORLD DIRECTORY FILES FIRST.
pause

:start
SET incrnumbercounter=1
ECHO. Extracting Master file to %extractdir%
"%_7zipdir%\7z.exe" x "%backupdir%\IncrMaster_*.7z" -y -o"%extractdir%"

goto incrstart

:incrstart
IF %incrnumbercounter% GTR %incrnumber% (goto finished) ELSE (goto incrcheck)

:incrcheck
IF EXIST "%backupdir%\incr_#%incrnumbercounter%_*.7z" (goto incrextract) ELSE (goto ERROR)

:ERROR
ECHO Incremental backup #%incrnumbercounter% not found. Restore will attempt to find next incremental backup file.
ECHO This may result in corrupt restoration. Press enter to search for next backup file or exit batch.
ECHO.
SET /a incrnumbercounter=incrnumbercounter+1
pause
goto incrstart

:incrextract
ECHO Extracting Incremental Backup file #%incrnumbercounter% of %incrnumber%

ECHO.
"%_7zipdir%\7z.exe" x "%backupdir%\incr_#%incrnumbercounter%_*.7z" -y -o"%extractdir%"
SET /a incrnumbercounter=incrnumbercounter+1
goto incrstart

:finished
ECHO Restoration of backup #%incrnumber% in %backupdir% completed.
ECHO.
ECHO All files restored to %extractdir%.
ECHO.
ECHO If restoring from a V2.5 backup or above you will have Server Files located in _ServerFiles directory of your restored world directory.
ECHO You will need to manually restore these to your server directory if needed.
ECHO.

:end
pause
exit

saveall.vbs:

http://www.gamercide...kup/saveall.zip


'VBS Script to force Minecraft Server to save all
'By Dateranoth - August 28, 2010
'v1.0 - Initial Release
'v1.1 - Added lines to bring window into focus before key strokes.
'v1.2 - Condensed Keystroke Commands. Added Server Backup notification
'v1.3 - Moved Backup notification ahead of save-all to decrease likelyhood of save-all not being ran.
Set WshShell = WScript.CreateObject("WScript.Shell")

'Enter the name of your Server Window Here bewteen the quotations
T1 = "Minecraft Server"

Sub KeyIt(Keystroke, WinTitle)

WshShell.AppActivate WinTitle

WScript.Sleep 100

WshShell.SendKeys Keystroke

End Sub

WshShell.AppActivate WinTitle
Call KeyIt( "{ENTER}", T1)
'Comment out the two lines below if you wish to disable notification
Call KeyIt( "(say --Backing up World--)", T1)
Call KeyIt( "{ENTER}", T1)
Call KeyIt( "{ENTER}", T1)
Call KeyIt( "(save-all)", T1)
Call KeyIt( "{ENTER}", T1)


Wscript.Quit

Thanks to

MonkeyDKS and his original Backup Utility

instinx for integrating Overviewer

brownan for the Overviewer Application.

ZomBuster for Cartograph

http://www.gamercide.org for hosting and support of the server

Share this post


Link to post
Share on other sites

Love being a Comp Sci major and understanding what's going in code now instead of being 'wtf.' That's pretty cool stuff. I'm not into Minecraft, but my roommates are so I might get them to sign up here and join in on the fun.

Share this post


Link to post
Share on other sites

Love being a Comp Sci major and understanding what's going in code now instead of being 'wtf.' That's pretty cool stuff. I'm not into Minecraft, but my roommates are so I might get them to sign up here and join in on the fun.

lol. I'm glad you can appreciate my hacked together batch code. I normally don't know whats going on either. What took me hours to make a good programmer could have done in probably no time at all. haha, I'm always learning as I go as it's not my chosen profession.

You should certainly get your friends signed up here. We can get them going on the Alpha server if they'd like. Though we are still waiting for the inventory to be fixed.

Share this post


Link to post
Share on other sites

I'm not a "good programmer" by any means since I'm only a sophomore in this field, but that might take me about 30-45 minutes to come up with since it's basic executions. What programming languages do you know? I only know Java, Python, a hell of a lot of C, quite a bit of C++, and some C#. If you want to take this to PMs then feel free to so I don't derail the thread.

Share this post


Link to post
Share on other sites

I'm not a "good programmer" by any means since I'm only a sophomore in this field, but that might take me about 30-45 minutes to come up with since it's basic executions. What programming languages do you know? I only know Java, Python, a hell of a lot of C, quite a bit of C++, and some C#. If you want to take this to PMs then feel free to so I don't derail the thread.

lol. No derailing here. I doubt I'll see many posters in this thread.

Honestly, I don't "know" any. I use my basic understanding of how programming works and the internet to find examples and make what I need. That's why it takes so long. I usually know what I can do with a program but not the exact commands to call. I've scripted in games such as morrowind and oblivion. Done a little java for my website etc, and a fair amount of PHP. Haven't really gotten into any of the C languages and never messed with Python at all. Most of my programming needs are minor and only needed when I really want something. Like the batch file above. Very simple once I knew what I needed, but it took a while to figure out the commands. Even remembering the compression commands for rar.exe and 7z.exe. Finding the date formats and the correct format for IF statements. I KNOW the basics and what should work, but I'm always having to look up the correct syntax. lol, I don't do any of it nearly enough to remember them.

I think PHP and java would be most useful to me, and I'd like to learn PHP. However, I've studied and went pretty far into PHP, but since I rarely use it I just keep forgetting it.

PS

I forgot quotes around my worldnamdate and realized now that it wasn't time stamping files in the am. Also had an extra L being called by the VBS script. Fixed it.

Share this post


Link to post
Share on other sites

New updates:

Added delay before Cartograph starts. Was freezing up when it started too soon after the files were compressed.

Added proper comment lines and new ones.

Updated VBS Script to bring window into focus first. Was sometimes missing the first letter when trying to save all.

All files and scripts updated in OP.

Share this post


Link to post
Share on other sites

V1.4

Added check for temporary file that was locking up Cartograph. If found, deletes tmp file before running Cartograph

Previous timer for Cartograph reduced. Lock ups were probably the temp file the entire time. Timer left in for a just in case measure.

Added line in Variable to change the map type that Cartograph creates. Will need to refer to Cartograph Readme.txt for options otherwise set to normal.

All files and scripts updated in OP.

Share this post


Link to post
Share on other sites

::V1.5-Added Minecraft Overviewer Option for mapping-----------------------------------::

::----Edited by instinx - smithtec(AT)gmail.com----------------------------------------::

::----October 6th, 2010 - Added Option for using Minecraft Overviewer------------------::

::----http://github.com/brownan/Minecraft-Overviewer-----------------------------------::

::V1.6-Cleaned up a lot of code. Added option to only run Overviewer after a certain----::

::-----amount of time. Instructions for Overviewer found in User Variables-------------::

Overviewer has been added and I highly recommend it be used if you want a very detailed zoomable map of your world. Thanks to instinx for the integration of it. I'm currently working on FTP to upload Overviewer files to webserver after it is ran. Instinx is working on an incremental backup.

Share this post


Link to post
Share on other sites

::V1.7-Added ability to use WinSCP FTP to upload Overviewer map to remote website-------::

::-----Runs a Synchronize command so only files that have changed will be uploaded------::

::-----Also cleaned up some more code and rearranged User Variables.--------------------::

::-----Download WinSCP Here: http://winscp.net : Required for FTP Upload but Free App---::

Next revision will hopefully have incremental backups working. This should help reduce the backup time and system resources required to perform it.

Share this post


Link to post
Share on other sites

Incremental Backups are finally here! Refer to the OP for full details. This took me a long time and headache but it was worth it.

::V1.8-MAJOR UPDATE! Added option to use Incremental Updates. Incremental updates-----::

::-----greatly reduce total backup time and space. Incremental updates store one master::

::-----backup file in a dated directory. Then dated incremental updates of only changes::

::-----are produced on the next backup run. The very first run will create Cache files-::

::-----of both the world directory and the compressed backup in your backup directory.--::

::-----They will be used to produce incremental updates without recopying the full world::

::-----directory or recompressing the full directory. They will only be deleted if the-::

::-----backup script detectes a restored backup. This is done by a folder named--------::

::-----_IncrBackupRestored being created in the archives. If you restore a backup it----::

::-----will be placed in your world folder so the backup script will know to purge the--::

::-----cache. Otherwise you can manually delete the files in IncrBackupCache to force--::

::-----what is basically a full backup to be done. I'm working on a simple restore-----::

::-----script, but for now you must first extract the IncrMaster_Worldname.7z and then--::

::-----extract, in order overwriting existing files the incr_# until you get to the time::

::-----you wish to restore. Everytime you restart the script or restore a backup a new-::

::-----dated folder is created with a new master and it's own set of incremental backups::

::-----**************************IMPORTANT READ BELOW****************************-------::

::-----WinRAR is NOT SUPPORTED FOR INCREMENTAL BACKUPS. You must use the 7-zip method.-::

::-----With the addition of Incremental backup 7z.exe is no longer REQUIRED to be in----::

::-----the backup directory, but there now is an option to set the path to the exe------::

::-----This must be set for either FULL or INCREMENTAL backups to work------------------::

::-----**************************************************************************-------::

::-----Additionally I added the option to change how often Cartograph runs, and---------::

::-----rearranged some of the code for a smoother script. Along with modifications to---::

::-----check for winrar methods and notify user that Incremental backups are not--------::

::-----Supported for WinRAR. 7-ZIP is a free program so RAR support seemed uneccessary-::

::V1.9-Name Changed from SMPBackup to MCBackup. The backup package now includes a------::

::-----script to easily and quickly restore backups. Refer to it for directions.-------::

::-----http://www.dateranoth.com/gamercide/MCRestore.zip--------------------------------::

Share this post


Link to post
Share on other sites

::V2.0-Modified the way batch captures time/date from system. Added the ability to-----::

::-----change the date format. Refer to User Variables for more information------------::

Users can now change the way the folder date is saved. This is helpful for non standard date format users, and users who just prefer it a different way.

Share this post


Link to post
Share on other sites

Hey, thanks for the script, it's really useful. Got one question however. Whenever I close the MCBackup.bat and run it again, it rewrites every file to the server again. Why is that? I thought by checking it would realise they're the same, obviously not. Is there a setting that prevents this? I've got incremental backps set to on already.

And adding an option for the type of FTP protocol might not be a bad idea, I had to go through the code after I found out SFTP doesn't seem to work on my server.

Share this post


Link to post
Share on other sites

Thanks for posting. Can you clarify what the backup is doing? Incr backups create a new folder every new run but it shouldnt recopy everything or take a long time unless you cleared the cache or restored a backup.

The ftp portion only uploads overviewer files atm. The process takes a long time because it compares every local file with the remote ones. It should only upload the changed ones.

. Ill look into a protocol option and the option to upload actual backups today.

Share this post


Link to post
Share on other sites

Nevermind, I made it log the transfers and it was only uploading tiles with later dates. I didn't realise it needed to do so many though.

Yeah, it does take a lot of tiles. I can't think of any better way to do it since you want it only upload new files. No matter how I change it it has to compare every local file to every remote file. I'm still going to look into adding ftp upload of the world backups and an option to change the protocol.

Share this post


Link to post
Share on other sites

::V2.1-Added a max incremental count. This counter will create X number of incremental-::

::-----backups before starting a new folder and master file. This is so users who use--::

::-----regular incremental backups can create a new master folder daily or whenever.----::

::-----Which will in turn make restoring much easier and faster. If you do not wish to--::

::-----use the feature then set it to a very high number. ie. 9999999-------------------::

Share this post


Link to post
Share on other sites

When I run the Utility I get:


Starting Back up of MineCraft World - World1

Forcing Server to save world
The system cannot find the path specified

Starting Initial Run of Backup. New, dated folder will be created and Incr Backups will be started there until Script restarted

I also don't see any Overviewer output happening

::Set to use Incremental Backup.  Only supports 7zip compression method. (yes or no)
::Incremental will create one base file and then only the changed updates from that point forward in 7-zip format.
::In order to restore the world you MUST extract the base file and then the changes in order until the date/time you wish to restore is reached.
SET UseIncr=yes

::Set to the number of Incremental Backups you would like created before a new folder and master file is created.
::If you multiply this number by your backup Time you will get the amount of time between new incremental folder creation.
::ie. Backup time of 10 minutes, and an Incremental Backup # of 6 would create a new master and folder every 60 minutes.
SET IncrCounterMax=336

::Set Server Directory (The folder your "World" folder lives in...NOT the path inside your world folder)
SET WorldDIR=C:\Users\Administrator\MineCraft

::Set World Name (Copy your World Folder name here)
SET WorldNAM=World1

::Set Backup Directory (Where do you want to save your backups?)
SET BackupDIR=E:\Overviewer\Backup

::Set Time between Backups (in minutes)
SET Timer=30

::Set Compression Method (rar or 7zip)
SET Method=7zip

::Set Directory for 7z.exe
SET _7zipdir=C:\Program Files\7-Zip

::Set the format you would like the date to appear on backup files. Default is year(%%g)-month(%%e)-day(%%f). Your windows time format may differ.
:: If it does or you would like something different then rearrange the parameters below until satisfied. Results will be format1-format2-format3
set dateformat1=%%g
set dateformat2=%%e
set dateformat3=%%f

::Would you like to use the VBS file to force a save-all to your server? yes or no
SET UseVBS=yes

::Set directory where saveall.vbs is located
SET VBSDir=C:\MineCraft_Server

::Will you be using Sleep.exe? (yes or no)
SET UseSleep=no

::Set Sleep EXE directory if using Sleep.exe
SET SleepExe=C:\windows\system32

::Would you like to use Cartographer to map your backups? yes or no
SET UseCart=no

::Set directory where Cartograph.exe is located
SET CartDIR=C:\Minecraft_Server\Cartographer

::Set Cartograph map type. Refer to Cartograph Readme.txt for more info or leave at default setting.
SET CartMap=normal 0 0 0 0

::Set how often you would like Cartograph to be ran. (in minutes) Minimum is the time between backups.
::Will only be ran when a backup runs. ie. If your backup time is every 30 minutes, then Cartograph
::can be set to run every 30 minutes, 1 hour, 1 hour and 30 minutes, 2 hours, etc.
::Odd times will round forward, running after the time has been met but not until the backup starts.
::Time can be different from Overviewer Time.
SET CartTimer=240

::Set to 0 if you DON'T want Cartograph to run when the batch file is initially opened.
SET CartFirstRun=0

::Would you like to use Overviewer to map your backups? First run can take a LONG time. (yes or no)
SET UseOVWR=Yes

::Which method of Overviewer? Windows Executable or Python Script? (exe or python)
SET OVWRmethod=python

::Set directory where Overviewer is located
SET OVWRDIR=E:\Overviewer

::Set Overviewer Image Directory (Overviewer Output)
SET OVWROUTDIR=E:\Current Map

::Set Overviewer CACHE Directory (Where Overviewer Cache files are stored)
SET OVWRCACHEDIR=E:\Overviewer\Cache

::How many processors should Overviewer Use? (This should be set low or it will cause lag on the server)
SET Procs=1

::Set how often you would like Overviewer to be ran. (in minutes) Minimum is the time between backups.
::Will only be ran when a backup runs. ie. If your backup time is every 30 minutes, then Overviewer
::can be set to run every 30 minutes, 1 hour, 1 hour and 30 minutes, 2 hours, etc.
::Odd times will round forward, running after the time has been met but not until the backup starts.
::Time can be different from Cartograph Time.
SET OVWRTimer=360

::Set to 0 if you DON'T want Overviwer to run when the batch file is initially opened.
SET OVWRFirstRun=1

::Would you like to use WinSCP FTP to upload the Overviewer map to a web server? (yes or no)
::If connecting to a secure ftp the first run will ask you to save the key to cache.
::Once saved it will run automatically without user input from that point on.
SET useftp=yes

::WinSCP is required. Please set the path to WinSCP
SET ftpwinscpdir=E:\WinSCP

::Set your ftp address here WITHOUT ftp:// (site:port)
SET ftpurlport=ftp.zjnewbs.com:21

::Set the login name for your FTP.
SET ftploginname=blah blah blah

::Set the password for your FTP.
SET ftploginpass=blah blah blah

::Set the max upload bandwidth you want WinSCP to use (kibps)
SET ftpspeed=50

::Set your REMOTE ftp directory for Overviewer. Should be base directory containing index.html. (Full Remote Path)
SET ftpovwrdirectory=E:\Overviewer\MapView

Am I doing something wrong here?

Share this post


Link to post
Share on other sites

The first part looks like the VBS file is not in the directory you have it pointed to. Check C:\Minecraft_Server and make sure the .vbs file is in there.

The overviewer not running could be a number of things. If you're not using the EXE version then you must have the python executable in your windows PATH variable. I"ll add the option to set the directory in the next patch. I'm not 100% sure that's your problem though. Download this:

http://www.dateranoth.com/gamercide/MCDebug.zip

and remove the @ECHO OFF line from the top of the backup script. Place MCDebug.bat in the same directory as MCBackup.bat and run MCDebug. It should output a dated log file. Open it and XXXX out any passwords it may log, and then upload it here. I'll take a look at it and see what the issue is. If it is just the path to Python you can scroll down to this line:

Python gmap.py --cachedir="%OVWRCACHEDIR%" -p "%Procs%" "%TempWorldDir%" "%OVWROUTDIR%"

and place your path in front of Python. ie:

C:\mypythondirectory\Python "%OVWRDIR%\gmap.py" --cachedir="%OVWRCACHEDIR%" -p "%Procs%" "%TempWorldDir%" "%OVWROUTDIR%"

Share this post


Link to post
Share on other sites

Is there suppose to be a visual thing that happens when Overviewer starts? Or is it all in the background?

I realized my problem with the save-all, I was dumb and didn't put the VBS into my Minecraft folder.

However it still just goes through the saving incremental, and then says Everything is OK, then starts its backup schedule. I have run when batch is started set to "1", I also modified the batch to point to my Python folder. C:\Python27

*UPDATE*

So I tried running Overviewer manually, and it gives me

Microsoft Windows [Version 6.0.6001]

Copyright © 2006 Microsoft Corporation. All rights reserved.

E:\Overviewer>python gmap.py c:\Users\Administrator\Minecraft\World1 e:\Overviewer\Current Map

'python' is not recognized as an internal or external command, operable program or batch file

E:\Overviewer>C:\python27\python gmap.py c:\Users\Administrator\Minecraft\World1 e:\Overviewer\Current Map

c:\python27\python: can't open file 'e:\Overviewer\gmap.py': [Errno 2] No such file or directory

I got a feeling this is happening due to the fact I am trying to do all this stuff on seperate drives. C: is for running MC, D: is for full backups, E: is for running Overviewer.

Hmm, gives me the same issue even with Overview on the C Drive

Share this post


Link to post
Share on other sites

Is there suppose to be a visual thing that happens when Overviewer starts? Or is it all in the background?

I realized my problem with the save-all, I was dumb and didn't put the VBS into my Minecraft folder.

However it still just goes through the saving incremental, and then says Everything is OK, then starts its backup schedule. I have run when batch is started set to "1", I also modified the batch to point to my Python folder. C:\Python27

*UPDATE*

So I tried running Overviewer manually, and it gives me

Microsoft Windows [Version 6.0.6001]

Copyright © 2006 Microsoft Corporation. All rights reserved.

E:\Overviewer>python gmap.py c:\Users\Administrator\Minecraft\World1 e:\Overviewer\Current Map

'python' is not recognized as an internal or external command, operable program or batch file

E:\Overviewer>C:\python27\python gmap.py c:\Users\Administrator\Minecraft\World1 e:\Overviewer\Current Map

c:\python27\python: can't open file 'e:\Overviewer\gmap.py': [Errno 2] No such file or directory

I got a feeling this is happening due to the fact I am trying to do all this stuff on seperate drives. C: is for running MC, D: is for full backups, E: is for running Overviewer.I tried the above as it is, and with

The last thing you listed should work. Here are the things you need to look for. In E:\Overviewer do you have a gmap.py file? If not then is it an EXE? If it's an exe you need to change to the exe method. If neither gmap.py or an exe is in the directory then you either A.) Don't have it extracted properly or B:)Are pointing to the wrong directory. ( maybe it's in a a subdirectory? )

Let me know if it's either of the above issues is the cause. The backup batch itself seems to be doing what it's suppose to. It just can't find the file it needs to execute Overviewer.

Share this post


Link to post
Share on other sites

It is an .exe, but for some reason when I ran the map the first time I downloaded gmap.py worked...

I am just a moron I guess. I will change it and get back to yo.

Oh and quick question:

::Set your REMOTE ftp directory for Overviewer. Should be base directory containing index.html. (Full Remote Path)

That is for the website side correct?

This is what Win SCP looks like when I log in, is the remote directory just "/root"?

FTP.png?t=1288146861

Share this post


Link to post
Share on other sites

It is an .exe, but for some reason when I ran the map the first time I downloaded gmap.py worked...

I am just a moron I guess. I will change it and get back to yo.

Oh and quick question:

::Set your REMOTE ftp directory for Overviewer. Should be base directory containing index.html. (Full Remote Path)

That is for the website side correct?

Yes, that's for uploading the Overviewer map to a website. If you don't need it, just change the ftp option to no. If the Overviewer file is an exe, then changing the Overviewer type back to exe should fix the problem for sure.

::Which method of Overviewer? Windows Executable or Python Script? (exe or python)

SET OVWRmethod=exe

My next update should have an option to upload the backups to ftp as well. Let me know if the exe method doesn't fix your problem. Hope you enjoy the utility.

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

×