PDA

View Full Version : Status of copy in an "after copy" bash script?


acronce
01-07-2008, 12:23 PM
Hi all,

I'm interested in firing off an "after copy" bash shell script that emails whether the copy succeeded or not. I'm familiar with shell scripts, and I can see from the manual how to invoke them after an SD copy is performed.

But what isn't clear is how to determine from the shell script whether or not the copy was successful. There are parameters passed to a "before copy" shell script that indicate what copy was performed and where. But I don't see anything about parameters passed to an "after copy" script, like the error from the copy.

Maybe the status of the copy is passed in "$?" parameter?

Thanks in advance for any suggestions.

Best,
--
Allen Cronce

dnanian
01-07-2008, 12:31 PM
The status isn't passed in, because it's not called if there was an error.

acronce
01-07-2008, 01:01 PM
The status isn't passed in, because it's not called if there was an error.

Oh. So that means the only way for me to know that an error happens is if I don't get an email. That might be tough to remember 6 months from now when a server backup fails.

It would be nice if there was some sort of facility to run an error script.

Or maybe this issue will be sidestepped when the new Growl support is finalized?

Best,
--
Allen Cronce

dnanian
01-07-2008, 01:03 PM
I don't know what you mean, Allen: if you use the current Growl support, it'll tell you if there was an error OR a success.

acronce
01-07-2008, 02:05 PM
I don't know what you mean, Allen: if you use the current Growl support, it'll tell you if there was an error OR a success.

Oh, sorry. I thought that was a new feature based on the title of the sticky poll in this forum. But it looks like that thread was originally posted a long time ago.

I really haven't looked at Growl support at all yet. I did a search in the User's Guide before posting, but didn't find anything.

Looks like I need to do a little research to see if Growl will provide an alternative solution to my notification problem.

Best,
--
Allen Cronce