Incremental backup.
Copy new files from one directory to another:
#I found Copy, XCopy and similar really SLOW when copying from local to S3 mapped drive.
emcopy64.exe <source> <destination> /d /nosec /s /log+:backup.log
Directories zip & copy.
I use these 2 lines to make a full-copy of my websites to an S3 mapped drive, monthly (just in case the other 100 backup systems fails :)
#get "timestamp" we will use for directories names 'mywebsite-03202016.zip'.
FOR %%A IN (%Date:/=%) DO SET timestamp=%%A
#Go throught first-level directories, zip them, then move each zipped file to the backup destination drive
FOR /D %%S IN (<source>\*) DO (7za a -r -y %%S-%timestamp%.zip %%S & MOVE %%S-%timestamp%.zip <destination>)
Download IP Database file, and modify related website settings reference.
To get my site's visitors country I use an IP-to-country file database provided by MaxMind.com. They update database weekly, and I use the next commands to get each new version on my sites.
We basically DOWNLOAD DATABASE FILE + RENAME IT + COPY TO WEBSITE + MODIFY WEBSITE SETTINGS reference. Let's go.
#get "timestamp" we will use to rename the IP database file to something like 'GeoIP2-Country-03202016.zip'
FOR %%A IN (%Date:/=%) DO SET timestamp=%%A
#Get the IP/country database file from MaxMind.com and save it (we use a new directory for each download).
wget -d --no-check-certificate "https://download.maxmind.com/app/geoip_download?edition_id=GeoIP2-Country&suffix=tar.gz&license_key=<your-license-key>" -O ./%timestamp%/"GeoIP2-Country.tar.gz"
#Extract "GeoIP2-Country.mmdb" file from downloaded zip.
7za e -r -y -o.\%timestamp%\ .\%timestamp%\GeoIP2-Country.tar.gz
7za e -r -y -o.\%timestamp%\ .\%timestamp%\GeoIP2-Country.tar
#Rename the IP Database file using timestamp (that is the new refecence for our websites).
copy .\%timestamp%\GeoIP2-Country.mmdb .\%timestamp%\GeoIP2-Country-%timestamp%.mmdb
#Copy the new downloaded file database to your website directory.
copy .\%timestamp%\GeoIP2-Country-%timestamp%.mmdb <your website directory>\ipdatabase\GeoIP2-Country-%timestamp%.mmdb
#we use a file called currentIPDatabase.txt to save current version file name, so we can search on site settings to replace.
set /p lastIPDatabase=<currentIPDatabase.txt
fart -i -q "<your website directory>\web.config" %lastIPDatabase% GeoIP2-Country-%timestamp%.mmdb
#save new database file name as the current IP database.
@echo GeoIP2-Country-%timestamp%.mmdb>currentIPDatabase.txt
... and now I can use the updated database on my sites by just getting the new file reference:
public static class Globals {
static DatabaseReader _MaxMindDatabase =
new DatabaseReader(HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath + "/ipdatabase/") +
ConfigurationManager.AppSettings["IPDatabaseFile"]);
public static DatabaseReader MaxMindDatabase
{
get
{
return _MaxMindDatabase;
}
}
}
Maybe a brute-force solution (don't like to modify the web.config), any ideas?