Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

rsync confirmation message?

Guys,

I'm using a shell script to backup files, and would like to know if it's possible to take the results of a successful rsync backup (and/or an error message) and use this (possibly using system events?) to produce simple messaging (dialogs)?

This is the first time Ive used shell scripts in AS and I've tried several ways to do it, but none have worked thus far.

this is where I am presently with this part of the script:

try
set src to POSIX path of ("USBDRIVE:" as alias)
set dest to POSIX path of (choose folder with prompt "Choose the destination directory" default location (path to desktop))
display dialog "Your files are being Archived" & return & ". . . . please wait while this process completes" giving up after 3
do shell script "rsync -blah " & quoted form of src & space & quoted form of dest
on error
display dialog "ARCHIVING OF FILES FAILED !!" & return & return & "Please Manually transfer the files from" & return & "the CFCARD to the Backup Drive"
end try

Inserting a simple dialog at the end of this script does not confirm a successful backup, and pops up regardless of what's happened of course.

I doubt this is the best way to do what I've done so far, but as a newbie, I'm still learning!

Thanks

iMac 2.6Ghz Core 2 Duo, Mac OS X (10.6.2)

Posted on Jan 1, 2011 9:52 PM

Reply
Question marked as Best reply

Posted on Jan 1, 2011 10:12 PM

Inserting a simple dialog at the end of this script does not confirm a successful backup, and pops up regardless of what's happened of course.


Sure, but if you insert your confirmation dialog after the shell script and within the try/on error statements you'll get what you want.

You see, statements within the try block are executed in sequence until an error occurs at which point execution jumps to the on error statement (if there is one).

Therefore, if you consider the flow:

try
-- setup statements
do shell script "rsync --blah blah blah blah"
display dialog "All Done!"
on error
display dialog "Ooops, something went wrong"
end try


You see, if the do shell script throws an error execution jumps to the on error statement. If the shell script executes successfully then the following statement, namely your confirmation dialog, runs.
4 replies
Question marked as Best reply

Jan 1, 2011 10:12 PM in response to st3v1e

Inserting a simple dialog at the end of this script does not confirm a successful backup, and pops up regardless of what's happened of course.


Sure, but if you insert your confirmation dialog after the shell script and within the try/on error statements you'll get what you want.

You see, statements within the try block are executed in sequence until an error occurs at which point execution jumps to the on error statement (if there is one).

Therefore, if you consider the flow:

try
-- setup statements
do shell script "rsync --blah blah blah blah"
display dialog "All Done!"
on error
display dialog "Ooops, something went wrong"
end try


You see, if the do shell script throws an error execution jumps to the on error statement. If the shell script executes successfully then the following statement, namely your confirmation dialog, runs.

rsync confirmation message?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.