Handy script for cleanup (WGSCLEAN.bat)

Discussion on running your own board and editing MajorMUD.
cjt
Posts: 135
Joined: Fri May 11, 2012 8:54 pm

Handy script for cleanup (WGSCLEAN.bat)

Post by cjt »

Two recommendations in this post. First, use DropBox or some other cloud solution as a means to create redundancy in your backups. I don't care if you have 19 harddrives at your house replicating the data; you're solution isnt as good as theirs. Second, this script rotates the data out after 3 days of storage. Theoretically you wouldn't need to roll back any further than 3 days. Most likely, any further than your last backup. However, I like to plan for the worst. For my solution, I have the main DropBox directory located on my desktop. I established a MUDBACKUP directory within DropBox and then situated a 3DAY, 2DAY, 1DAY folder within the MUDBACKUP directory. The script rotates the files and deletes those that were in the 3DAY. Remember, you must have rar.exe located in the WGSERV directory to use WinRAR. Also, you can delete the second to last line, regarding WBB files, if you're only running a single mud. If you're running 2+ games, just add another line for each active mud with reference to their call letters.

@echo off
del /q C:\Users\Administrator\Desktop\Dropbox\MUDBACKUP\3DAY\*.*
move C:\Users\Administrator\Desktop\Dropbox\MUDBACKUP\2DAY\*.rar "C:\Users\ctaylor\Desktop\Dropbox\MUDBACKUP\3DAY"
move C:\Users\Administrator\Desktop\Dropbox\MUDBACKUP\1DAY\*.rar "C:\Users\ctaylor\Desktop\Dropbox\MUDBACKUP\2DAY"
move C:\Users\Administrator\Desktop\Dropbox\MUDBACKUP\*.rar "C:\Users\ctaylor\Desktop\Dropbox\MUDBACKUP\1DAY"
rar a -rr -ag-MMM-DD-YY C:\Users\Administrator\Desktop\Dropbox\MUDBACKUP\MUD1backup.rar wbb*.*
rar a -rr -ag-MMM-DD-YY C:\Users\Administrator\Desktop\Dropbox\MUDBACKUP\MUD2backup.rar wcc*.*


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by syntax »

Similar script, also backs up WG--

Code: Select all

mkdir _backup
rar a -rr -xwccupda2.dat -ag-MMM-DD-YY _backup\wccbackup.rar wcc*.*
del _backup\wccmmud.log
move wccmmud.log _backup\
rar a -rr -ag-MMM-DD-YY _backup\wgsbackup.rar wgs*.dat
Modify as needed.


User avatar
BearFather
Posts: 652
Joined: Sun Feb 09, 2014 6:27 pm
Location: Portland, OR
Contact:

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by BearFather »

Here's my backup file. I also inculde 2 days of the users account files in my backups.

Code: Select all

@echo off
C:\PROGRA~1\WinRAR\rar a -rr -ag-MMM-DD-YY mudbackup\wbbbackup.rar wbb*.*
C:\PROGRA~1\WinRAR\rar a -rr -ag-MMM-DD-YY mudbackup\wccbackup.rar wcc*.*
del C:\WGSERV\mudbackup\WGSUSR2.dat1
ren C:\WGSERV\mudbackup\WGSUSR2.dat WGSUSR2.dat1
copy C:\WGSERV\WGSUSR2.dat C:\WGSERV\mudbackup\WGSUSR2.dat


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by syntax »

So I actually just made mine this... why not back up the whole damn thing?

Code: Select all

mkdir ..\_backup
rar a -o+ -r -rr -xwccupda2.dat -ag-MMM-DD-YY ..\_backup\backup.rar *.*
del ..\_backup\wccmmud.log
move wccmmud.log ..\_backup\


User avatar
Kyau
Posts: 77
Joined: Sun Jul 13, 2014 2:35 am
Location: Seattle, WA
Contact:

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by Kyau »

Figured I would toss mine into the mix here as it is a tad different than everyone elses.

My nightly script backs up two separate MUDs into two separate files and if it is Monday it also backs up the entire Worldgroup directory. This translates into:
  • Nightly Multi-MUD Backups
  • Weekly Worldgroup Backups
  • Uses 7zip for maximum compression

Code: Select all

@echo off
@setlocal
@set PATH=%PATH%;C:\Program Files\7-Zip
@set mydate=
@for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined mydate set mydate=%%x
@set info=%mydate:~0,8%
@rem Current date is %mydate%
@rem Added file information is %info%
@CD\WGSERV
if %date:~0,3%==Mon (
    @7z a -scsDOS -mx9 -mmt -t7z -r -xr!+AfterMUD "C:\MUDBACKUP\WGSERV-%info%.7z" *.*
)
@7z a -scsDOS -mx9 -mmt -t7z -r "C:\MUDBACKUP\MajorMUD-%info%.7z" WCC*.*
@7z a -scsDOS -mx9 -mmt -t7z -r "C:\MUDBACKUP\AfterMUD-%info%.7z" WBB*.*
Modify the `WGSERV` directory and `MUDBACKUP` directories in the batch file to meet your needs.


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by syntax »

Love a good batch script. FYI though, you don't need any of those preceding @ symbols after the first @echo off. "@" hides the current line, @echo off does everything after it until echo is turned back on. I also don't see any reason to "setlocal", but it doesn't hurt anything either.


User avatar
Kyau
Posts: 77
Joined: Sun Jul 13, 2014 2:35 am
Location: Seattle, WA
Contact:

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by Kyau »

Good catch on the echo off, probably remnants of my copy pasta habit.


User avatar
MiOw
Posts: 113
Joined: Tue Nov 15, 2016 7:40 pm

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by MiOw »

Very happy to have found this topic, I am hoping to have a batch that will do a two things on a standard board installation in the WGSERV directory:

1. Copy out and/or zip the wgsaudit.adt file with a date stamp to a C:\BACKUP\WGSAUDIT folder and then clear or delete/replace the wgsaudit.adt file in the WGSERV directory (it gets very large with the ongoing non-SGA connections).
2. Subsequently (or first is fine) create a copy of the WGSERV directory to the C:\BACKUP\WGSERV folder.

I assume the addition of the wgsaudit.adt file operations to one of the files already referenced would be pretty simple but any headstart or assistance would be appreciated. I like to use it periodically as a way to peek at where different user connections are coming from.

Also, is there anything needed beyond putting the wgsclean.bat file into the folder to have it run?

Thank you!


ClassicMUD... lightly seasoned with no dupes!
www.mudinfo.net/viewtopic.php?f=64&t=2357
User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by syntax »

The one I posted ( http://www.mudinfo.net/viewtopic.php?p= ... b41d#p4336 ) backs up the entire WG folder, minus wccupda2.dat. If you copy a blank audit file into your backup folder then you could add the following to your batch:

copy /y c:\backup\wgsaudit.adt c:\wgserv

or, if you want to exlicitly name it "wgsaudit_blank.adt" in your backup folder then you could do:

copy /y c:\backup\wgsaudit_blank.adt c:\wgserv\wgsaudit.adt

and that would just overwrite the file with a blank one (your backup of the current one would be in the zip of the entire folder you just made). And yes, the batch is ran automatically during cleanup, iirc.


User avatar
MiOw
Posts: 113
Joined: Tue Nov 15, 2016 7:40 pm

Re: Handy script for cleanup (WGSCLEAN.bat)

Post by MiOw »

syntax wrote:The one I posted ( http://www.mudinfo.net/viewtopic.php?p= ... b41d#p4336 ) backs up the entire WG folder, minus wccupda2.dat.
If I were to be picky and want it in the C:\BACKUP would I simply put "C:\BACKUP\" in place of the "..\_backup"?

Thanks again!


ClassicMUD... lightly seasoned with no dupes!
www.mudinfo.net/viewtopic.php?f=64&t=2357
Post Reply