Automatic Backup Batch Script!

Discussion in 'Bukkit Tools' started by XOIIO, Nov 25, 2011.

?

What do you think of this program?

  1. GREAT!

    42.9%
  2. Good

    14.3%
  3. Not Bad

    14.3%
  4. Needs Improvement

    28.6%
  5. Hate It

    14.3%
Multiple votes are allowed.
Thread Status:
Not open for further replies.
  1. Offline

    XOIIO

    Hello all, I'vre been working on this batch script for a while, basically it automatically backs up the /world directory of your server once every 5,10,15,20,25, or 30 minutes. (you can set it to more.)

    I will include the batch file, there are just a couple things you need to configure.

    They are amrked in the abtch file, but you simply need to put in your servers directory with /world on it, such as "C:\minecraftserver\world", and the directory your backup will be in. In the batch file it is already typed in to make a \MCSERVERBACKUP folder, so you would jsut need to put something like C: in front of it.

    You also need to set the time interval, I included time conversions for 5 minute intervals up to 30 minutes, the script needs them in seconds, so you just copy and paste the number in isntead of "your time here"

    It's important to ahve lots of hard drive space, with a 60mb world this program filled up close to 200GB in a bit around four days backing up every 5 minutes, so be sure to keep an eye on it.

    All the backup folders are made with the time and date as the name so it's easy to keep track of, and you can delete old ones easily.

    screenshot.2.jpg

    I like to have this run beside the bukkit console so you can keep an eye on both if you looka t your server.

    screenshot.1.jpg

    While the program is running it also shows you how long it is waiting for until the next backup.

    screenshot.3.jpg
    So there you go, if you have any questions or requests just tell me, I'll be happy to comply.

    You can also add a line into the batch file to start bukkit to start this too, if you awlays want it to start backing up when the server starts.
     

    Attached Files:

  2. Offline

    h0us3cat

    There is already one.
    But the code of this one looks cleaner.
    Does it support ftp backup?
    Can you add map render support like the one i linked has?
     
  3. Offline

    XOIIO

    It definitely took a long time to find the right code to make the timestamps.

    Since that one seems to run mostly on Batch/VBS yes, I'll take a look at the code behind it, and find a way to incorperate it nicely. I'm not too fammiliar with automatic FTP uploading but it should be simple. It would also work if you have a network drive such as a DROBO with just the file path.

    Yes, after looking at the code for a bit it seems fairly straightforward, I have no private FTP server though, but I will try to incorperate this feature into the program, and upload a version with this in case it doesn't work properly, the old one will still work.


    I also have a batch script (made it an executeable with an icon) to back up and restore the minecraft saves and jar file, if you ar eitnerested I could dig it up as well, it works nice for client side stuff.
     
  4. Offline

    fury

    first of all :I recommend the @echo off line (I havn't used this .bat file, but it looks somewhat messy by the pictures-unless you want it that way) next: you stole some of my idea...
     
  5. Offline

    XOIIO

    If you are talking about the messy thing linked in that other thread no I did not. I cam up with this because I needed it, not because I saw someone else do it. I didn't even know you had one.

    Echo is turned off, the screens either show it waiting and the time remaining, or the file names as they are bing copied, then it changes back.
     
  6. Offline

    Paintmiester

    This is just what i'm looking for, but... where's the batch file???
     
  7. Offline

    XOIIO

    Wierd, it dissapeared.

    Well, here is the code, if you need any help let me know.

    Echo OFF
    color 0a
    title MineCraft AutoBackup
    :Loop
    CLS
    echo BACKING UP!
    echo.
    rem Timestamp Generator
    rem Parse the date (e.g., Fri 02/08/2008)
    set cur_yyyy=%date:~10,4%
    set cur_mm=%date:~4,2%
    set cur_dd=%date:~7,2%
    rem Parse the time (e.g., 11:17:13.49)
    set cur_hh=%time:~0,2%
    if %cur_hh% lss 10 (set cur_hh=0%time:~1,1%)
    set cur_nn=%time:~3,2%
    set cur_ss=%time:~6,2%
    set cur_ms=%time:~9,2%
    rem Set the timestamp format
    set timestamp=%cur_yyyy%%cur_mm%%cur_dd%-%cur_hh%%cur_nn%%cur_ss%%



    XCOPY /E /H "C:\Users\Administrator\Desktop\MCServer\world" "E:\MCServerBackup\%timestamp%\"
    rem Clear the environment variables
    set cur_yyyy=
    set cur_mm=
    set cur_dd=
    set cur_hh=
    set cur_nn=
    set cur_ss=
    set cur_ms=
    set timestamp=

    echo.
    echo DONE!
    ping localhost -n 4 >nul
    cls
    echo WAITING...
    timeout /nobreak /t 300
    GOTO Loop
     
  8. Offline

    KirkEBarrett

    Thank you. That batch is excellent.
     
Thread Status:
Not open for further replies.

Share This Page