Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: UPDATES
- :: Jan 2, 2023
- :: ADDED "/I" TO XCOPY. SEEMS TO KEEP CRASHING THERE FOR A FOLDER OR FILE
- :: I = DEFAULTS TO FOLDER IF IT DOES NOT EXISTS
- ::
- :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: :::: B A C K U P . B A T ::::
- :: :::: MINECRAFT SERVER BACKUP ::::
- :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: AUTHOR: R.SCORPIO rickscorpio64@gmail.com
- :: WEBSITE: https://rustycraftmc.blogspot.com/
- @echo off
- title "BACKUP SERVER"
- :: ----------- EDIT THIS SECTION ------------------------------------
- :: mc drive and directory
- set mcdrive=c
- set mcfolder=c:\MinecraftServer
- :: put the name of the world you want to backup
- set worldname=world
- :: BACKUP folder name
- set backupDrive=c
- set backupFolder=c:\MinecraftServer\backups
- `if not exist %backupfolder% mkdir %backupfolder%
- :: ---- DO NOT EDIT PAST HERE ---------------------------------------
- :backup
- cls
- echo " _____
- echo " __|___ |__ ______ _____ __ _ ______ _____
- echo "| ___| || ___|| |\ \ //| ___|| |
- echo " `-.`-. || ___|| \ \ \// | ___|| \
- echo "|______| __||______||__|\__\ \__/ |______||__|\__\
- echo " |_____|
- echo " _____
- echo " __|___ |__ ____ ______ __ __ __ _ _____
- echo "| > || \ | ___|| |/ / | | | || |
- echo "| < || \ | |__ | \ | |_| || _|
- echo "|______> __||__|\__\|______||__|\__\|______||___|
- echo " |_____|
- echo.
- :: get on the chosen backup drive
- %backupDrive%:
- :: switch to backup folder
- cd "%backupFolder%\"
- :: get current time
- for /f "tokens=2-4 delims=/ " %%a in ('DATE /T') do (set var=%%c-%%a-%%b)
- :: create a dated folder in the backup folder based on the date from above
- md %var%
- :: start the backup
- echo Backing up %worldname% one moment...
- :: change folder to your liking
- set dropboxTargetFolder=minecraft
- :: get location of downloaded dropbox
- set dropbox=%userprofile%\dropbox
- :: check to see if this folder exists, if not tell
- :: users to download it
- if not exist %dropbox% (
- echo Get Dropbox for PC before using this!
- goto :eof
- )
- if not exist %dropbox%\%dropboxTargetFolder%\%var% mkdir %dropbox%\%dropboxTargetFolder%\%var%
- if exist %dropbox%\%dropboxTargetFolder% xcopy /Y /e /c /exclude:%mcfolder%\exclude.txt "%mcfolder%\%worldname%\*.*" %dropbox%\%dropboxTargetFolder%\%var%
- :: LOCAL Backup
- :: COPMMENT OUT THE FOLLOWING IF YOU DO NOT WANT TO BACKUP LOCAL
- :: RECOMMEND JUST KEEPING IT IN PLACE IF FOR SOME REASON YOU LOOSE I-NET ACCESS.
- xcopy /Y /e /c /i /exclude:%mcfolder%\exclude.txt "%mcfolder%\%worldname%\*.*" "%backupFolder%\%var%"
- echo Backup completed successfully..
- echo.
- echo Cleaning up backup folder
- :: we dont want anything longer than 7 days of back up. thats plenty.
- :: THIS WORKS FOR LOCAL BACKUP ONLY - NOT VERIFIED FOR DROPBOX (OR OTHER ONLINE BACKUP SERVICES)
- %backupDrive%:
- cd "%backupfolder%\"
- :: for info on FORFILES use FORFILES /?
- FORFILES /S /D -7 /C "cmd /c IF @isdir == TRUE rd /S /Q @path"
- :: UPDATE IP ADDRESS (FOR DNSEXIT FREE IP REDIRECT)
- :: This will ensure that if my IP changes, it will automatically update the free DNS address
- ::
- :: To get updated script
- :: https://dnsexit.com/users/dns/dyn/
- echo Updating DNSEXIT (rustycraft.linkpc.net) IP forward address
- curl https://api.dnsexit.com/dns/ud/?apikey=k8mS1wGv8UY35oqIe7A49nXZrF9jAM -d host=rustycraft.linkpc.net
- :: get back to the minecraft folder
- :: some problems testing.. hard code this if vars do not work.
- :: %mcdrive%:
- c:
- cd "%mcfolder%"
- exit
Advertisement
Comments
-
- NEW FOR 2023 - backup batch file for your minecraft server. Put it on a windows Task schedule.
-
- HOW TO USE:
- This is probably one of the more elaborate backups for your minecraft servers.
- PRO'S
- - can back up to your local directory
- - can back up to a remote backup service - default is DROPBOX
- - If you use DNSEXIT (similar to no-ip BUT it is hands off, no need to keep logging in etc..)this will auto update your IP address
- - DOES NOT NEED TO HAVE SERVER SHUT DOWN TO BACKUP!
- INSTALL
- - Make a batch file in your minecraft server root folder.
- - CREATE A FILE = "exclude.txt" with the following line session.lock then save it in your MC server directory.
- - make sure there is a backup folder (I have since fixed that in the batch file just sayin! LOL)
- - Edit folders in the 'EDIT THIS SECTION'
- - Edit the DNSEXIT from the site provided. If not used just delete or comment out that line
- - Edit the DROPBOX section 58, 70-74, if not used comment out or delete (if you have any other links for other remote backups, love to see them here
- That's it. Test it by running it. Optional, make an entry in your windows TASK SCHEDULER.
-
- WOW did not realize the interest in this (good or bad). Say hi if you take a look at this, or comment. Thanks again!!
Add Comment
Please, Sign In to add comment
Advertisement