Automating Backups: Windows
The following Scripts are supplied to illustrate how it is possible to automate the backup of CatDV preferences and MySQL database they are free to use and modify but are provided with no further support or development.
As with any backup strategy there is no substitute for regular testing that backups are stored and can be recovered correctly. Disaster recovery tests are strongly recommended.
Knowledge of scripting will be needed to adapt these scripts to suit a specific environment or business needs
Each script creates a folder on the User desktop called CatdvBackups with the sub folders
serverprefs clientprefs workerprefs Database
It then copies and date stamps the various files into the corresponding subfolder
there are comments in each script to help indicate what each section does and suggestions on where modifications can be made
It is possible to automate these scripts to run to a schedule using task scheduling features within the host operating system, below are links indicating how to do this
Using Task scheduler in pc environments http://www.7tutorials.com/how-create-task-basic-task-wizard
Windows Batch script
copy and paste the text between the ####### sections into a text file and save it as catdv_backup.bat on the desktop right click file and select run as administrator to run
alternatively download the file here and rename the extension to .bat CatDVBackup.txt
#######################################################################################
REM Batch File to back up key CatDV preferences files @echo off REM turns of echo of script lines comment out with REM to see full outputREM — Prepare the Command Processor — SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION REM — Set the window title — SET “title=Batch File to back up key CatDV preferences files” TITLE %title% REM — Set the paths and folder names — REM to change the name of the backup folder Type the name below in place of CatdvBackups ( no more than 30 characters alphanumeric with no white space)(this will be automatically substituted throughout the rest of the script) SET _Bfolder=CatdvBackups REM to modify the location of your backup folder change the path by replacing the string %HOMEPATH%\Desktop\ with the preferred path (this will be automatically substituted throughout the rest of the script) SET _Bpath=%HOMEPATH%\Desktop\ SET _MYSQLpath=C:\Program Files\MySQL\MySQL Server 5.5 REM echo the output folder ECHO %_Bpath%\%_Bfolder% REM — Create Directories at backup target — REM change folder to Backup path cd %_Bpath% REM make a folder named by the variable %_Bfolder% MD %_Bfolder% CD %_Bfolder% REM change folder to %_Bfolder% and then make sub folders MD serverprefs MD clientprefs MD workerprefs MD Database REM — Copy the files and date + timestamp the backups — @echo on REM copy server prefs and rename with date and timestamp copy “c:\Program files\Square Box\CatDV Server\catdv.properties” “%_Bpath%\%_Bfolder%\serverprefs\” ren “%_Bpath%\%_Bfolder%\serverprefs\catdv.properties” “catdv-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.properties” REM copy client prefs and rename with date and timestamp copy “%HOMEPATH%\catdv.prefs” %_Bpath%\%_Bfolder%\clientprefs\ ren “%_Bpath%\%_Bfolder%\clientprefs\catdv.prefs” “catdv-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.prefs” REM copy worker prefs and workset file rename with date and timestamp copy “%LOCALAPPDATA%\Square Box\worker.xml” %_Bpath%\%_Bfolder%\workerprefs\ ren “%_Bpath%\%_Bfolder%\workerprefs\worker.xml” “worker-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.xml” copy “%LOCALAPPDATA%\Square Box\workset.xml” %_Bpath%\%_Bfolder%\workerprefs\ ren “%_Bpath%\%_Bfolder%\workerprefs\workset.xml” “workset-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.xml” REM –run repair clean and optimize DB and then backup catdv server database– REM auto repair DB “%_MYSQLpath%\bin\mysqlcheck.exe” -u catdvadmin -pcatdv catdv –auto-repair REM check DB for errors “%_MYSQLpath%\bin\mysqlcheck.exe” -u catdvadmin -pcatdv catdv -c REM optimise DB “%_MYSQLpath%\bin\mysqlcheck.exe” -u catdvadmin -pcatdv catdv -o cd %_Bpath%\%_Bfolder%\Database REM export DB and rename with date and timestamp “%_MYSQLpath%\bin\mysqldump.exe” -u catdvadmin -pcatdv catdv > CatDV_DB_backup-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.sql REM — End of application — ECHO.&ECHO.Press any key to end the application.&PAUSE>NUL&GOTO:EOF
#############################################################################