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: 1578
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.
axeman2u


Joined: Jun 16, 2025
Messages: 1
Offline
I tries the Apple Script you provided and it seems to work, but not exactly as expected. I edited it to notify me of cancellations if the success value was "1". I tested it by running a capture. The capture was successful, but the script sent me email saying the operation was cancelled. The message failed to tell me who it was cancelled by. Here's the message:

The QRecall action 'Capture MacOS Ext to MacOS Ext.quanta' was cancelled by ''.

Archive: MacOS Ext.quanta

Perhaps the data names are a little different now, and that's why the user name didn't show, and the cancelled message was triggered after a successful capture?

At any rate, I hope the script can be updated to work properly with the latest version of QRecall. I would also like to know what value commandSuccess would have upon a successful run, so I can get a script to run in that case too.

Thanks for any help!
James Bucanek


Joined: Feb 14, 2007
Messages: 1578
Offline
I'll need a little more detail about exactly what you want your script to accomplish. In the meantime, I'd like to clarify the meaning of a few of the variables passed to the script at the end of execution.

QR_COMMAND_SUCCESS: This is '1' if the command finished normally. Note that this does not mean "complete". It means there was not a failure. Cancelling an action is not considered to be a "failure."

QR_COMMAND_CANCELED: This variable is only present if the command was canceled. So if you want to do something when an action is canceled, you need to look for the presence of this value. The value is a number that indicates the source of the cancel message. For example, the value '4' means that a TERM (i.e. "Quit") signal was sent by another process. It is not a user or process ID. See the documentation for a complete list of possible values and their meaning.

QR_COMMAND_EXCEPTION: The documentation isn't actually correct on this value. It will certainly be present if QR_COMMAND_SUCCESS is '0', but it can also be present if something (like a user cancel) interrupted the normal progress of the action. This is, I believe, what you're seeing in your example.

I hope that helps a little, and if you follow up with a description of what you'd like your script to do I'm confident that something can be crafted that will accomplish that.

- QRecall Development -
[Email]
 
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