Register / Login  |  Desktop view  |  Jump to bottom of page

Cookbook and FAQ » Notification for Successful or Failed Backups

Author: Bernd Stein
5 years ago
Does anyone have a good solution for getting notified by email or iMessage about the "Success, Warning, Failure" status of a Qrecall action?

I know there is the epilog script option. Can people share their scripts for sending email or iMessages that report on e.g. the success or failure of a capture action.

I am managing the backups of several family members and need to get notified if something goes wrong with their backups.


Author: James Bucanek
5 years ago
Here?s one solution, that assumes you?re using Apple Mail.

First, update to QRecall 2.1.7. There?s a bug in 2.1.6 that doesn?t reliably run the epilog script after an error.

Launch the Script Editor (built-in app the comes with macOS).

Create a new document and paste in this code:

set commandSuccess to (system attribute "QR_COMMAND_SUCCESS")

if commandSuccess is "0" then
-- the command's success is "0" (in other words, the action was NOT successful)
-- note: if the action was canceled, QR_COMMAND_SUCCESS will be "1" and QR_COMMAND_CANCELED will be <who>,
-- so if you want to be notified of canceled actions you'll need to add a check for that.
-- note: that if run as a prolog, there is no QR_COMMAND_SUCCESS value, so this will never execute

-- compose a message with a summary of the problem
set recipientName to "QRecall Administrator"
set recipientAddress to "your@email.com"
set theSubject to "QRecall action failed"
set theContent to "The QRecall action '" & (system attribute "QR_COMMAND_TITLE") & "' failed." & return & return ¬
& "Reason: " & (system attribute "QR_COMMAND_EXCEPTION") & return & return ¬
& "Archive: " & (system attribute "QR_ARCHIVE_NAME_DISPLAY")

tell application "Mail"
-- create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
-- set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
-- and send the message
send
end tell
end tell
end if

Edit the value of the recipientAddress at a minimum, but feel free to customize the name, subject, and content values to suit your needs.

Save the file as a compiled AppleScript (.scpt) file.

In QRecall, open the actions you want to be notified, by email, when they fail. Click the ?Select? button in the Epilog script and select the AppleScript file you just saved. The ?Needs UI? option should automatically get checked, but just make sure it is. Save the action.

That?s it.

After each edited action runs, it will execute this AppleScript which will see if the action finished successfully, or at least non-fatally. If it was successful, it does nothing. If there was a failure, it opens the Mail app, composes, and sends a message to the address in recipientAddress.

Author: Bernd Stein
5 years ago
Great, the script is working fine. Exactly what I needed.




Register / Login  |  Desktop view  |  Jump to top of page