Since we have to shut Vault down to back it up and script the backup process at the command line, (don’t get me started on how dumb this is,) it’s usually done late at night. But I don’t want to sit there at 2 AM waiting for Vault to complete it’s cycle and read the log. Now I don’t have to! Thanks to Ryan Small at SolidCAD for pointing out this nifty utility in the Vault discussion group! BMail is a small SMTP sender that lets you send e-mail from the command line. Download that utility and extract the bmail.exe, then place it in the …\Data Management Server 5\Vault Manager\ directory. Now add this part to your Vault Backup Script at the end:
bmail -s SMTPSERVER -h -t RECIPIENT -f Vault@Backup.Status -a “Vault Backup Status” -m BACKUPLOG -c
Watch for wordwrap, and change the SMTPSERVER and RECIPIENT as needed. I’d suggest you experiment sending yourself some messages from the utility to make sure it’s working before you add it to the script completely.
And be sure to talk to your IT team about this, many SMTP servers will refuse to relay traffic or only allow authorized senders, so some configuration might be needed. Hope this helps you sleep better, Vault Admins!
I’ll give it a shot next week.
Thanks.
Fun with date/time scripting.
:: Vault backup script for CGL created by Mark Evinger
echo off
for /f “Tokens=1-4 Delims=/ ” %%i in (‘date /t’) do set dt=%%l-%%j-%%k
for /f “Tokens=1-2” %%i in (‘time /t’) do set tm=-%%i-%%j
set tm=%tm::=-%
set dtt=%dt%%tm%
:: set DT returns yyyy-mm-dd drops the day of week (%i). If you want it back use set dt=%%i-%%j-%%k-%%l
:: set tm returns -HH-MM-am/pm
:: use windows management instrument control to guarantee day of week for any Win2000/WinXP/Win2003
for /f “Tokens=1-11 delims=, ” %%i in (‘wmic path win32_localtime get * /format:csv’) do set dayweek=%%k
if %dayweek% == 0 set DayOfWeek=Sunday
if %dayweek% == 1 set DayOfWeek=Monday
if %dayweek% == 2 set DayOfWeek=Tuesday
if %dayweek% == 3 set DayOfWeek=Wednesday
if %dayweek% == 4 set DayOfWeek=Thursday
if %dayweek% == 5 set DayOfWeek=Friday
if %dayweek% == 6 set DayOfWeek=Saturday
echo %dt%
echo %tm%
echo %dtt%
echo %DayOfWeek%
echo %dtt%-%DayOfWeek%
REM: Cycling the SQL server
NET STOP MSSQL$AUTODESKVAULT /Y
NET START MSSQL$AUTODESKVAULT
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:: Delete “B” and Cascade “A” backup subdirectories
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
RMDIR /Q /S “E:\VaultBackupS\B”
MOVE /Y “E:\VaultBackups\A” “E:\VaultBackups\B”
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:: Start the backup process
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MKDIR “E:\VaultBackups\A\”
“C:\Program Files\Autodesk\Data Management Server 2008\ADMS Console\Connectivity.ADMSConsole.exe” -Obackup -B”E:\VaultBackups\A” -VUadministrator -VPAdminPASSWORD -VAL -S -L”C:\Program Files\Autodesk\Data Management Server 2008\LOGS\%dtt%-%DayOfWeek%_VaultBackup.log”
“C:\Program Files\Autodesk\Data Management Server 2008\ADMS Console\bmail.exe” -s EMAIL_SERVER -h -t UserName@domain.com -f Vault@Backup.Status -a “Vault Backup Status” -m “C:\Program Files\Autodesk\Data Management Server 2008\LOGS\%dtt%-%DayOfWeek%_VaultBackup.log” -c
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:: Defragment the Database
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
“C:\Program Files\Autodesk\Data Management Server 2008\ADMS Console\Connectivity.ADMSConsole.exe” -Odefragment -NVault -VUadministrator -VPAdminPASSWORD -S -L”C:\Program Files\Autodesk\Data Management Server 2008\LOGS\%dtt%-%DayOfWeek%_VaultDefrag.log”
“C:\Program Files\Autodesk\Data Management Server 2008\ADMS Console\bmail.exe” -s EMAIL_SERVER -h -t UserName@domain.com -f Vault@Backup.Status -a “Vault Backup Status” -m “C:\Program Files\Autodesk\Data Management Server 2008\LOGS\%dtt%-%DayOfWeek%_VaultDefrag.log” -c
:: log file directory must be created first, files stored in form of 2007-07-06-03-48-PM-Friday_VaultBackup.log
:: and 2007-07-06-03-48-PM-Friday_VaultDefrag.log
:: bmail.exe available from http://www.beyondlogic.org/solutions/cmdlinemail/bmailv107.zip