Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Happybobjr on May 02, 2011, 05:48:52 pm

Title: Minecraft backup script.
Post by: Happybobjr on May 02, 2011, 05:48:52 pm
Could someone help me with a script that would back up my Minecraft server every half hour?
(By help, I mostly mean doing it for me.)
It should have 24 backups (12 hours worth) and when that is done it overwrites the first backup.

Backup 1
Backup 2
....
Backup 24
Backup 1


I know a little C and i am fluent in Axe (not sure if the latter helps :P )



I have been in this community for quite some time, so even though this isn't a computer programing community, I know you guys won't give me viruses :/ )
Title: Re: Minecraft backup script.
Post by: qazz42 on May 02, 2011, 06:25:36 pm
well, you could make a .bat file that gets run every 30 mins that copyies your server to a backup folder. IDK how that would work (in regards to the every 30 mins thing)
Title: Re: Minecraft backup script.
Post by: ruler501 on May 02, 2011, 06:27:57 pm
The every 30 min thing you could create in Windows easily(if admin), but I don't know how to do it in other OS's. It is just a scheduled task. I'm sure every OS can do it
Title: Re: Minecraft backup script.
Post by: Silver Shadow on May 02, 2011, 06:32:01 pm
Try checking out Bukkit and its plugins. I'm pretty sure you'll find something of that sort there.
Title: Re: Minecraft backup script.
Post by: Happybobjr on May 02, 2011, 07:50:07 pm
Kick me as hard as you can.  I was thinking of asking to be banned for wasting time with such a dumb question. (it may not be dumb to you as you may not have been exposed to such things)  I had to save as a bat file instead of txt :P

I found this.
How do i compile it?

:: CHANGE THESE VARIABLES TO SUIT YOUR NEEDS ::
set WORLD_LOC=c:\Users\James Oldiges\Desktop\Minecraft Server\world
set BACKUP_LOC=c:\Users\James Oldiges\Desktop\Backup
:: DO NOT EDIT BEYOND THIS LINE ::
for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set TODAY=%%A-%%B-%%C

set BACKUP_LOC_TODAY=%BACKUP_LOC%\%TODAY%
cd "%BACKUP_LOC_TODAY%"

for /F %%A in ('chdir') do set CURRENT_DIR=%%A

if "%BACKUP_LOC_TODAY%" NEQ "%CURRENT_DIR%" (mkdir "%BACKUP_LOC_TODAY%")
xcopy "%WORLD_LOC%" "%BACKUP_LOC%\%TODAY%" /D /E /C /R /H /I /K /Y