Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript to email Retrospect backup failures Apps
We wanted to have an email sent to us if a Retrospect backup failed to execute in the past X hours. On one of our servers, we have Retrospect running and if Retrospect crashes in the middle of a backup, it doesn't automatically notify us. So, we modified an included AppleScript, resulting in this new script. We compiled it as an application and have it execute twice a day using cron.

Key features for this to work are the python script macmail.py, which is included in Retrospect's Applescript -> Python directory (it needs to be placed in /Library -> Preferences -> Retrospect). Also, this script works by checking the last modified date of a file. We have Retrospect set to output a CSV file (this option is under Preferences) with backup statistics after a backup successfully completes, and so we are checking our time frames against the modification date of this file.

We had left in the code that emails for successful backup execution, but we have removed this and left it for debugging purposes only.
    •    
  • Currently 1.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[13,217 views]  

An AppleScript to email Retrospect backup failures | 10 comments | Create New Account
Click here to return to the 'An AppleScript to email Retrospect backup failures' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Any issues with Applescript and Mail.app?
Authored by: steviestar on Feb 27, '06 10:42:59AM

I'm looking forward to trying this out in my environment as the built in Retrospect notification script has stopped working for me. (Or, to clarify, has stopped working for me in conjunction with Mail.app.) Strangely, whenever Retro attempts to send the email upon completion/cancellation of a script, Mail.app balks, stating there are no recipients specified. Sure enough, that's the case even though the applescript clearly specifies recipients. I think this may be due to some bug somewhere between AppleScript and Mail because iCal does the exact same thing when I try to send invites out—that is, iCal attaches the event, but fails to send it because the recipients don't transfer from iCal to Mail. Has anyone else exprienced this? It only seems to be ocurring with 10.4.3 and above. Plus, it could well be a Mail.app issue, so I'll give it a whirl with python.



[ Reply to This | # ]
Any issues with Applescript and Mail.app?
Authored by: michno on Feb 27, '06 11:51:56AM

I have the exact same problem. They unsent mail is stored in the outbox, where you can see the recipient address clearly, but when you double-click they message Mail complains about a missing recipient. When you close the message again, the recipient address returns!!!



[ Reply to This | # ]
Any issues with Applescript and Mail.app?
Authored by: gjw on Jun 04, '06 10:46:05AM

Hopefully people will see this even though the original message is months old. Apparently with the current version of mail, specifying an address as the "name" property of a receipient doesn't work. Change the Retrospect script to build "address" properties instead and it should start to flow.



[ Reply to This | # ]
A shell script may be better suited for this
Authored by: Rainy Day on Feb 27, '06 12:02:38PM
Given the task (i.e. a cron job to send an eMail if the modification date of a file isn't what you expect), you may be better off writing a bash script for this. It'll be a lot leaner and, more importantly, far more robust. Doesn't require the use of the GUI Mail.app, doesn't depend on Python, doesn't have the overhead of AppleScript.

Just a thought.

[ Reply to This | # ]

A shell script may be better suited for this
Authored by: erikh on Feb 28, '06 02:30:10AM
Not to mention, cron can do this for you if you print something to the standard error.

[ Reply to This | # ]
Retrospect event handler in Python
Authored by: sabi on Feb 27, '06 12:19:44PM
You can implement a Retrospect event handler in Python with appscript—no AppleScript needed whatsoever. I've posted my monitoring script here.

It does a lot of stuff including automatically mounting/unmounting disks, generating a RSS feed for Retrospect status, and so forth, but it should be easy enough to rip that stuff out and do whatever you want with it.

[ Reply to This | # ]

Retrospect event handler in Python
Authored by: Ofir on Feb 27, '06 04:50:13PM

Any chance of a quick guide on how to get this to work?

Thanks



[ Reply to This | # ]
An AppleScript to email Retrospect backup failures
Authored by: osxpounder on Feb 27, '06 08:18:01PM

Any possibility of getting Retrospect Express to do this? I searched my Mac, but find no such .py script, so I suspect that email notification is not a feature of the Express version....

Still, if you can think of a way for it to email notification if it fails, I'd love to know. I'm poring over the included Help and find nothing hopeful there.

---
--
osxpounder



[ Reply to This | # ]
An AppleScript to email Retrospect backup failures
Authored by: willdaddy on Jul 10, '06 02:58:21PM

gjw's hint helped but it still took me quite a while to fix the Event Handler script.

Edit the Event Handler Script in the Script Editor and change:
set myAddressClass to myAddressClass & {name:myAddress}

to:
set myAddressClass to myAddressClass & {address:myAddress}

Hope this helps,
will



[ Reply to This | # ]
An AppleScript to email Retrospect backup failures
Authored by: ShosMeister on Feb 25, '07 06:38:25AM

I was searching for a sollution to the same problem for my system: OSX 10.3.9 and Retrospect 5.0.238. Since I didn't find any python scripts and didn't really want to try to set that up, I searched through the rest of the thread and found a comment at the bottom to change the concatenation of the address list. It said to change:

set myAddressClass to myAddressClass & {name:myAddress}
to
set myAddressClass to myAddressClass & {address:myAddress}

In my script, I had:
set myAddressClass to myAddressClass & {«class rdsn»:myAddress}

instead of the {name:myAddress}, but, I changed it anyway and it does appear to work.

Just thought I'd share.



[ Reply to This | # ]