cancel
Showing results for 
Search instead for 
Did you mean: 

Backup_exit_notify.cmd Script

Thuan_Le
Level 3
Hello,
Can someone help me how to setup a backup_exit_notify.cmd script? If possible please give an example how to use this script. I have one setup but it is not work.
Thank you for helping
1 ACCEPTED SOLUTION

Accepted Solutions

Stumpr2
Level 6
For these files to work, they must reside in the %install_path%\VERITAS\NetBackup\bin directory. Examples already exist in the goodies sub folder. Simply move it up one folder into the bin folder and modify it for you sites specific needs.

View solution in original post

22 REPLIES 22

Stumpr2
Level 6
For these files to work, they must reside in the %install_path%\VERITAS\NetBackup\bin directory. Examples already exist in the goodies sub folder. Simply move it up one folder into the bin folder and modify it for you sites specific needs.

Alan_Yeung
Level 3
In addition, for windows environment, you will need a 3rd party program "BLAT" to make it work. The program is free to download. Once "BLAT" is installed, you can then edit the script file(s) to enable alerts.

Thuan_Le
Level 3
Hi Alan,
I have a third e-mail party installed on the server.
Can you please tell me if my script is right?
I have this line at to the bottom of backup_exit_notify.cmd
@echo Status:%5 %DATE% Client:%1 Policy:%2 Sched:%3(%4) Stream:%6 >> %TEMP%\nbulog.txt
Thank you for helping

Alan_Yeung
Level 3
Here are the bulk of tasks you need to follow for the windows environment to get email working. I have separated into two parts.

Part I.

Configuring/Installing BLAT:
1. Download the .ZIP file from the download page specified above
2. Extract the files to their own folder.
Note: Most of the files in this .ZIP file are informational and is source code for developmental purposes.
3. Copy the blat.exe file to the \WINNT\System32 directory in Windows
4. From a command prompt, run the following command (Note: This will be the primary account that will
send the emails from the specified server):
blat -install
Note: "" is the hostname or IP address of the email server that will send the email
notifications.
"" is the account that will be the primary sender of the email notifications.
Example:
blat -install emailserver.company.com useraccount@company.com
Configuring nbmail.cmd
1. Open nbmail.cmd using notepad.exe or some other text editor. It can be found on a NetBackup
Server/Client install for Windows at %install_path%\VERITAS\NetBackup\bin.
2. Most of the lines in the nbmail.cmd file are informational. The following line is what needs to be adjusted
slightly:
@rem @blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG -q
3. Remove "@rem" from the line, making "@blat" the beginning of the line
4. Replace "WARTHOG" with the name of the email server. An example of how this line should now appear
is:
@blat %3 -s %2 -t %1 -i NetBackup -server emailserver.company.com -q
5. Save the nbmail.cmd file
Configure NetBackup to use email notification:
1. Open the NetBackup Administration Console
2. Open the Host Properties for the master server, go to the Universal Settings tab
3. Under the Administrator section of this page, select "Server sends mail" and enter the email address
for the NetBackup administrator in the field called E-mail address for the administrator of this
NetBackup Client:
NetBackup should send some email at this point. To get more information sent to the administrator
consistently, configuring some of the .cmd files in the %install_path%\VERITAS\NetBackup\bin directory
would result in more consistent information for the administrator.

Part II.

Assumption: The file nbmail.cmd has been configured and BLAT is running on the server.

NetBackup comes packaged with a number of script files that provide information on the different stages of backup jobs and other aspects of its functionality. The bulk of the .cmd script files can be found on the NetBackup master server in the %install_path%\VERITAS\NetBackup\bin directory.

Additional .cmd files can be found in the %install_path%\VERITAS\NetBackup\bin\goodies directory. For these files to work, they must reside in the %install_path%\VERITAS\NetBackup\bin directory. For the files in the \goodies directory, the original files should be copied to the \bin directory.

All of these files have one thing in common, a line that calls on the nbmail.cmd file and the phrase "someone_who_cares" in the line. The following is an example of how one of these files can be activated by making a modification to a single line.

Configuring backup_exit_notify.cmd:
The purpose of the backup_exit_notify.cmd file is the following:
(Note: This information is from the script. These files will have information to the intended purpose):

"This script is called by the NetBackup scheduler, after an individual client backup has completed (including media closure and image db validation."
To activate the script:
1. Open backup_exit_notify.cmd with a text editor
2. Find the following line in the script:

@REM - @call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%

3. Make the following changes to this line only:
(Note: The only change is removing the @REM at the beginning of the line and replacing "someone_who_cares" with the email address of the administrator):

@call %NB_MAIL_SCRIPT% user_account@company.com "NetBackup backup exit" %OUTF%

4. Save the file

When a backup job runs and completes, an email will be received by the configured email account.

Thuan_Le
Level 3
Hi Alan,
I tried your suggestion but it is not working. I did not get any e-mail after the backup ran.
The other question I have is in Part I. at the bottom of part I where it says "Netbackup should send some email at this point" I have followed your intruction step-by-step but I did not get any e-mail at all. Can you please help?
I know my BLAT e-mail is working, because I have Advance Report and I was able to send e-mail from there.
Thank you for your help.

Alan_Yeung
Level 3
Let's make sure your nbmail.cmd is working.

3 parameters are passed to the nbmail file:

@REM - %1 is the recipient's address
@REM - %2 is the subject line
@REM - %3 is the message file name

From command prompt try executing:

nbmail.cmd youremail@address.com TEST nbmail.cmd

If this works, you will receive an email with subject line TEST and the attachment of nbmail.cmd in the message body.

Also, you need to restart the netbackup services once you've edit the email to administrator setting.

Once you met both conditions above, you should start receiving mail.

Thuan_Le
Level 3
Alan,
I tried to test nbmail from a command line. I still did not get any email. I think there might be a problem with nbmail. However, I am able to e-mail reports from Netbackup Advance Report. So, I don't know whether is nbmail problem or something else.
Do you any suggestion? Pleaseeeee let me know.
Thank you

Alan_Yeung
Level 3
Test to make sure blat is working

For example:
Blat myfile.txt -subject "A file for pedro" -to foo@bar.com
// Sends a file with subject line "A file for pedro"

post your nbmail.cmd as well.

Thuan_Le
Level 3
Alan,
When I sent an e-mail this way it is work and I got a respond back and I got an e-mail.
C:\Documents and Settings\capcom>Blat myfile.txt -subject "A file for pedro" -to
tqle@ladpw.org
Sending myfile.txt to tqle@ladpw.org
Subject:A file for pedro
Login name is tqle@ladpw.org

However, when I used this command
nbmail.cmd tqle@ladpw.org TEST nbmail.cmd
it is not working.
do you have any idea why?
Thank you

Alan_Yeung
Level 3
Let's take a quick look at your nbmail.cmd. Post the file online.

Thuan_Le
Level 3
Alan,
Here is my nbmail.cmd
@REM $Header: nbmail.cmd,v 1.3 2003/06/25 18:07:46 $
@REM
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2004 VERITAS Software Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@REM - -
@REM - HOW TO SEND MAIL FROM THE NT NETBACKUP SERVER -
@REM - -
@REM - NetBackup checks if the mail script (NetBackup\Bin\nbmail.cmd) exists. -
@REM - If the script exists, NetBackup runs it passing three parameters on -
@REM - the command line: -
@REM - -
@REM - %1 is the recipient's address -
@REM - %2 is the subject line -
@REM - %3 is the message file name -
@REM - -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@REM - -
@REM - A public domain SMTP mail client for NT called BLAT is available at: -
@REM - -
@REM - http://www.interlog.com/~tcharron/blat.html -
@REM - -
@REM - Here's how to use BLAT with the NetBackup NT server. -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@blat %3 -s %2 -t %1 -i NetBackup -server pwex6.dpw.co.la.ca.us -q -enriched >>"E:\veritas\netbackup\logs\blat.out.txt"
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@REM - The -i option designates the originator's address, you may change this -
@REM - or omit it altogether (the default is the sender's address specified -
@REM - when BLAT was installed). -
@REM - -
@REM - The -server option is given as an example, you need to determine the -
@REM - correct name of your SMTP server. This option may also be omitted -
@REM - (the default is the server specified when installing BLAT). -
@REM - -
@REM - You may use any mail program you want, as long as it has a command line -
@REM - interface that can be used to send mail. Just substitute a call to -
@REM - your favorite mail program for the call to BLAT above. -
@REM - -
@REM - After modifying this script to suit your situation (make sure you are -
@REM - calling a valid mail program and the call is not commented out), -
@REM - activate it by moving it to the NetBackup\Bin directory. -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thank you

Alan_Yeung
Level 3
Ok,

Looks like the additional text at the end of the line is messing things up.

Change From
@blat %3 -s %2 -t %1 -i NetBackup -server pwex6.dpw.co.la.ca.us -q -enriched >>"E:\veritas\netbackup\logs\blat.out.txt"

To
@blat %3 -s %2 -t %1 -i NetBackup -server pwex6.dpw.co.la.ca.us -q

Then test again. :)

Thuan_Le
Level 3
Alan,
I have that before. I was not working.
I also retried it after I took those lines out. It's still not working.
This is what I did. I got no message respond like when I do Blat ......

C:\Documents and Settings\capcom>nbmail.cmd tqle@ladpw.org TEST nbmail.cmd

C:\Documents and Settings\capcom>

Alan_Yeung
Level 3
I'm suspecting your email system is not accept the sender Netbackup.

When the blat command worked, who was the sender in the email?

edit the nbmail.cmd and change the line to show the following:
@blat %3 -s %2 -t %1 -q

Save the file then run the following command.

nbmail.cmd myfile.txt "A file for pedro" tqle@ladpw.org

If this works out, edit the nbmail.cmd and add the -i validuser@ladpw.org

Where validuser is an actual user in the mail system.

Thuan_Le
Level 3
Alan,
I am sorry for taken too much of your time. I do appreciated you help.
I tried it, but it is not working either.
thank you

Alan_Yeung
Level 3
Please share your resolution when you get it to work!

Thanks,

Thuan_Le
Level 3
Alan,
This is the message I got when I took the -q out of script.
When I do this: nbmail.cmd myfile.txt "A file for Pedro" tqle@ladpw.org. The respond was tqle@ladpw.org does not exist.
I was able to use the same e-mail account for Blat.
do you have any suggestion?
Thank you for helping.

Joan_Weaver
Not applicable
We also had a problem trying to get email working. We had to add the 'mime' option to the blat statement in nbmail.cmd:

@blat %3 -s %2 -t %1 -i NetBackup -server SMTP.youremailserver.net -q -mime

Thuan_Le
Level 3
Hi Joan,
Thank you for responding to my question.
I tried your suggestion, but it is not working. Do you have any other ideas that I can try?
Thank you