Video Screencast Help

How do I add an email alarm to my batch file?

Created: 23 Jul 2012 • Updated: 17 Aug 2012 | 5 comments
This issue has been solved. See solution.

I am running SFWHA5.1sp2. I have a script that runs every morning with no problems. I would like to add a line at the end of the batch file that would send me a email and saying whether there were any errors. There is no email servers on my network and I was hoping to use port25/SMTP. I had someone tell my to use Blat but I have not been able to get it to work. Is there somthing already built into SFW that will do this?

This is what my script looks like.

vxassist -g AvMailDiskGroup remove Monday plex=Monday-01
vxassist -g AvMailDiskGroup snapback Monday
vxassist -g AvMailDiskGroup snapshot AvMailVolume plex=AvMailVolume-03 access=readonly DriveLetter=E Monday
vxassist -g AvMailDiskGroup mirror Monday

Comments 5 CommentsJump to latest comment

AlanTLR's picture

I don't know how you would use port 25/SMTP without a mail server.  By its definition a mail server would have port 25 open.

There is nothing built into the vxassist commands, nor the SFWHA (that I have found) that does this.  If there is one available, it would require a mail server.  I would recommend using PowerShell or checking on a Windows discussion group for a way to do this.

Also, VOM does have a way that you can upload custom scripts, and VOM can tell you if they ran correctly, but it still requires an SMTP server.  Also, I think the scripts have to be perl and I don't know if you would want to migrate your scripts to this just for email notifications, but it's another option that's available.

mhab11's picture

VEA has a SMTP configuration in the control panel. There is also a way to set up rules with SMTP notification. Not sure if you can use this with vxassit commands but there has to be some configuration that will work to notify me if my script fails.

AlanTLR's picture

Yes, the VEA smtp configuration does require an SMTP server to connect to.  Are you trying to email to an exchange account?  You may have to talk to your company's email administrator to allow email from your server.

mhab11's picture

I was going to setup a SMTP server on my backup box that is running server 2008r2, that should give me what I need to be able to get email alerts correct?

AlanTLR's picture

Yes, as long as you have an email server that will allow you to relay through.  If not, you may need to add a rewrite rule to rewrite the sending address to an existing user within your domain.