Pulvinar tempor cras amet ac turpis tristique tristique ... (read more)close
Pulvinar tempor cras amet ac turpis tristique tristique ... (read more)close

LukeTaylor.org Blog

Making I.T that little bit easier !

Sims.net Complete Backup Script

by in Windows Blog
  • Font size: Larger Smaller
  • Hits: 7188
  • 0 Comments
  • Print
7188

b2ap3_thumbnail_sims.jpg

Apart from the traditional server backups its always a good idea to have a good easy upto date backup of a CMS system such as Sims.net . I created the following script to allow us to have a daily backup of the main directory's and the SQL database in hand as part of the disaster recovery plan .

 

 

The Script

 

create the following on a drive before using this script .

 

C:\Temp

 

C:\Sims DB Backup

 

C:\Sims Directory

 

C:\Sims Doc Storage

 

Also install winrar on the server it will run on , this script will require task scheduler to automate . As this script (.bat) also has a password stored in plain text i would recommend converting it to an EXE.

 #backs up the Sims database to a temp directory .
"C:\SQL2008\MSSQL10_50.NAME\MSSQL\Binn\dbAttach.exe" /BACKUP /AUTO /SERVER=SERVER\NAME /DATABASE=SIMS /USER=SQLUSERNAME /PASSWORD=SQLPASSWORD /PATH=C:\Temp\SIMS_Backup.BAK
#puts the DB backup into rar and password protects with the password PASSWORD and moves it
"c:\program files\winrar\rar.exe" a "C:\Sims DB Backup\SimsDatabase.rar" -ri1 -mt2 -ag[yyyy-mm-dd] -rv10 -m5 -pPASSWORD F:\Temp\SIMS_Backup.BAK
#deletes the unrar'd backup
del C:\Temp\SIMS_Backup.BAK
#copys Sims root directory to Temp
xcopy /E /Y /K C:\Simsroot "C:\Temp"
#this now rars up the sims directory inside temp and adds the password PASSWORD and moves it
"c:\program files\winrar\rar.exe" a "C:\Sims Directory\SimsDirectory.rar" -ri1 -mt2 -ag[yyyy-mm-dd] -rv10 -m5 -pPASSWORD C:\Temp
#Remove the old temp folder
rd /s /q C:\Temp\
#recreate it
md C:\Temp
#copys the docstorage folder to temp
xcopy /E /Y /K C:\DOCSTORAGE "C:\Temp"
#rars up the docstorage folder and adds the password PASSWORD , and copys to the correct folder
"c:\program files\winrar\rar.exe" a "C:\Sims Doc Storage\SimsDocs.rar" -ri1 -mt2 -ag[yyyy-mm-dd] -rv10 -m5 -pPASSWORD C:\Temp
#Remove the old temp folder
rd /s /q C:\Temp\
#recreate the temp folder ( this is now empty )
MD "C:\Temp"
#This part deletes any files older than 90 days
FORFILES /P "C:\Sims DB Backup" /D -90 /C "cmd /c DEL @file"
FORFILES /P "C:\Sims Directory" /D -90 /C "cmd /c DEL @file"
FORFILES /P "C:\Sims Doc Storage" /D -90 /C "cmd /c DEL @file"

<

Rate this blog entry:
0

Comments

  • No comments made yet. Be the first to submit a comment

Leave your comment

Guest Wednesday, 13 November 2019