QRecall Community Forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 

Notification for Successful or Failed Backups RSS feed
Forum Index » Cookbook and FAQ
Author Message
Bernd Stein


Joined: Aug 28, 2018
Messages: 3
Offline
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.

James Bucanek


Joined: Feb 14, 2007
Messages: 1568
Offline
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.

- QRecall Development -
[Email]
Bernd Stein


Joined: Aug 28, 2018
Messages: 3
Offline
Great, the script is working fine. Exactly what I needed.
 
Forum Index » Cookbook and FAQ
Go to:   
Mobile view
Powered by JForum 2.8.2 © 2022 JForum Team • Maintained by Andowson Chang and Ulf Dittmer