06-28-2010 03:35 PM
Solved! Go to Solution.
06-29-2010 09:33 AM
06-29-2010 09:33 AM
06-29-2010 03:40 PM
07-14-2010 12:39 PM
With grateful help from my windows admins I think I got it! (if it would run on AIX I would have had this done faster and easier with cron and a script)
first I made a couple of changes to the dbbackup.bat file.
Added at the beginning and the end.
date /t
time /t
Added to the if section where it checks for return code of the actually backup A line to make and event ID that goes to windows Application event log
if %ERRORLEVEL% NEQ 0 (
echo ERROR backing up the %PRODUCT_NAME% Database, Exiting...
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db" del "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db"
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log" del "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log"
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db.org" copy "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db.org" "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db"
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log.org" copy "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log.org" "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log"
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db.org" del "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db.org"
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log.org" del "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log.org"
eventcreate /l application /so "NetBackup INET Daemon" /t error /id 69 /d "myservername backup to disk failure."
) else (
echo %PRODUCT_NAME% Database backup successful.
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db.org" del "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.db.org"
if exist "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log.org" del "%BACKUP_DIR%\%OPSCENTER_DB_DATAFILE_NAME%.log.org"
)
NOTE: made a copy of the dbbackup.bat in case any upgrade overwrites it. I just have to remember to check it after upgrades.
I want to keep one week of backups on disk on the server
So I made a backup dir
inside I made a dir for each day of the week.
Now I went to the windows Task Scheduler.
I made a task to run that dbbackup.bat script
General Tab:
change the user to be <domain>\ourjobrunningaccount
run weather user is logged on or not
Run with highest privileges
Configured for windows R2
Name is Friday Backup (made one for each day of the week)
Triggers Tab:
Begin task On a Schedule
Set to run once a week on Friday at 10:00 am (this is a quite time for NB so thought it would be a good time to get the OpsCenter backup done). It will go to tape that night when the normal system backup runs.
Enabled
Stop if runs longer then 4 hours
Actions Tab:
Action :Start a program
full path to the dbbackup.bat script
Add arguments E:\Backup\Friday > E:\Backup\Friday\task.log
(So the Friday task puts the backups in the Friday dir. and all output from the script will go into the task.log file for that day as well. Remember the date and time I added to the script. That will show up here in the task.log so if I want to see times or if it fails I can see all the output from the bat file here in the same dir as the backup was going)
Conditions tab:
Really up to you I have only start if the system is on, or start when it switches to battery so I can get a quick backup before it dies.
Settings:
Allow on demand
Run as soon as possible if it miss' a schedule ( could be due to system work)
Stop if it runs longer then 4 hours. (here is where I will be watching how long it runs in that task.log as I start it. As time goes buy it will run longer and longer and I really want to see just how long it takes)
=============
Now I create a task to monitor for the failure
General tab:
Name: Email Alert Backup Failure
again set to be run by our job account
Run even if not logged in
Set to Win R2
Triggers:
Begin task : On an event (this causes it to watch all the time for that event entry)
Settings: Custom
Edit event filter: XML
<QueryList>
<Query Id="0" Path="Application">
<Select Path="Application">*[System[Provider[@Name='NetBackup INET Daemon'] and (Level=2) and (EventID=69)]]</Select>
</Query>
</QueryList>
Enabled