[Box Backup-dev] Re: [Box Backup] ChrisMerge_1828

James O'Gorman boxbackup-dev at fluffy.co.uk
Fri Sep 14 23:11:43 BST 2007


--V32M1hWVjliPHW+c
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Sep 14, 2007 at 10:13:34PM +0100, Chris Wilson wrote:
>  Yes, the two messages above are sent at the start and end of each backup 
>  run, in recent versions. I've implemented a little code to ignore them in 
>  the version I checked in to CVS, but I have no idea if it's correct, not 
>  tested yet.

Yep, looks good to me. Oddly VBScript will throw an error if you did

ElseIf ...
Else ...

But putting a comment in between is fine. I can't remember off-hand if
other languages are the same or not.

>  Thanks for your help!

No problem. Knowing VBScript isn't one of my prouder languages, but
current day job requires it from time to time. Luckily I can get away
with Perl most of the time :-)

I've attached an svn diff now it's in the tree.

James

--V32M1hWVjliPHW+c
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="NotifySysAdmin.diff"

Index: NotifySysAdmin.vbs
===================================================================
--- NotifySysAdmin.vbs	(revision 1834)
+++ NotifySysAdmin.vbs	(working copy)
@@ -65,8 +65,10 @@
 
 Sub SendMail(from,sendto,subject,body)
 	Set objEmail = CreateObject("CDO.Message")
+	Set WshShell = CreateObject("WScript.Shell")
 	Dim cdoschema
 	cdoschema = "http://schemas.microsoft.com/cdo/configuration/"
+	
 	With objEmail
 		.From = from
 		.To = sendto
@@ -79,5 +81,15 @@
 			.Configuration.Fields.Update
 		End If
 	End With
-	objEmail.Send
+	On Error Resume Next
+	rc = objEmail.Send
+	If rc Then
+		WshShell.Exec "eventcreate /L Application /ID 201 /T WARNING " _
+			& "/SO ""Box Backup"" /D """ & args(0) _
+			& " notification sent to " & sendto & "."""
+	Else
+		WshShell.Exec "eventcreate /L Application /ID 202 /T ERROR " _
+			& "/SO ""Box Backup"" /D ""Failed to send " & args(0) _
+			& " notification to " & sendto & "."""
+	End If
 End Sub

--V32M1hWVjliPHW+c--



More information about the Boxbackup-dev mailing list