PDA

View Full Version : Script Hooks & Log Files


Levi
11-13-2008, 07:12 PM
Hello,

I would like to create a shell script which would get called after the copy process is finished which would send an email to myself.

I've read through the forums and the proposed solution of using Growl is not sufficient since the MailMe Growl plugin will not work with my mail configuration, etc.

I have written a script which can send mail, so that's no biggie, but there are some outstanding issues/questions I could use help on:

Does the "Run shell script after copy completes" option get called even if there is a failure prior? I don't think it does, so this prevents me from being able to send a failure message.

How can my script access the log of the copy operation so I can email it to myself?

Is there a better "hook" than the "Run shell script after copy completes" option which I can use to fire off emails when the copy completes totally (and in the case of a failure /or/ success)?

Does anyone know of a Growl plugin which can execute a shell/Applescript? If there was one, then I could use that to do what I want when SD! sends Growl the notification (I'm assuming SD! sends a notification to Growl on success or failure).

Thanks for your time,

Levi

dnanian
11-13-2008, 08:15 PM
Instead, Levi, just use the MailMe "Growl" action. It'll send mail on success...

Levi
11-14-2008, 03:10 AM
Hi Dave,

Thanks for the reply, but did you read my post? The Growl MailMe plugin is not sufficient (it lacks some basic configurability).

Thanks,

Levi

dnanian
11-14-2008, 08:10 AM
Clearly not carefully enough, Levi. If you search around on the forums, I think someone posted a sample script years ago that you can use as a basic starting point. That said, if you do use MailMe you can just look at the log if there's a problem -- after all, you're going to have to access to the system to fix it anyway, right?

Levi
11-14-2008, 08:03 PM
Hello again Dan,

Can you please answer the bullet points for me?

• Does the "Run shell script after copy completes" option get called even if there is a failure prior? I don't think it does, so this prevents me from being able to send a failure message.

• How can my script access the log of the copy operation so I can email it to myself?

• Is there a better "hook" than the "Run shell script after copy completes" option which I can use to fire off emails when the copy completes totally (and in the case of a failure /or/ success)?

Thanks,

Levi

dnanian
11-14-2008, 08:13 PM
It's Dave, Levi, not Dan.

Run after copy completes does not run if there's a failure, because the copy didn't complete.

A better way to do this is to modify the applescript "schedule driver" -- in there you'll find locations to run commands after a successful or failed copy.

Accessing the log would be based on the location of the script, and you'll find a general way to do this in the applescript. And as I said, you can find another example of this elsewhere in the forums by searching around a bit.