PDA

View Full Version : Scripting and the Log


edoates
07-18-2005, 03:13 PM
I'm a scripting newbie (though a programmer of other stuff for 40 years: remember Fortran?) and have question:

I'd like to add notification to the SD scripts to send me email upon script completion with a summary of the results: xx files (or GB) copied or ERROR SD did not complete type of thing. Can you provide a quick pointer on how to do that?

Second: is there a way to make the LOG less verbose? If I'm just backing up my iTunes music library (on a separate drive from my system), apparently I first have to make the script "ignore" everything, then add a "copy" for the music directory (is that correct). When I look at the log, it literally has hundreds of "ignored" entries to scan through to find the few "copied" entries. Is there a way to shorten the log?

Ed

dnanian
07-18-2005, 03:21 PM
Hi, Ed.

What I'd do is use Unix's "tail" command on the log, and then hunt through that to find the completion command with grep. (You can execute a shell script with applescript without much trouble -- that's what the lines that run "sleep" do.

Alternatively, you could use AppleScript to read/parse the log, but that'd probably be more difficult.

Regarding the log: alas, no. At present you can't make it less verbose, but I'll log that as an suggestion for the future.

Does that help?

edoates
07-18-2005, 03:35 PM
You must have your Mac email directly connected to your brain (kind of like my wife and her Treo 650, but I digress).

Yes, that helps and was sort of what I thought I'd need to do. It would be neat if SD could post values to script variables (completion code, # files copie, #ignored, bytes copied, elapsed time). Then I could get all that stuff directly rather than depending upon the log format to remain unchanged from version to version so that grep would work correctly.


Ed

dnanian
07-18-2005, 03:38 PM
At some point, we might post events to the scripts, Ed, which would allow this kind of thing to happen... but at the moment, it's of lower priority than some other stuff! :)

edoates
07-27-2005, 03:10 PM
looked at the log and noticed that "scanned" shows me total items and size, including the "ignored" stuff (most of it); but "copied" and "cloned" show items which were not actually copied with "smart update," but instead reflect the same values as if everything was copied: 6.64GB can't get copied in 2 seconds (see included partial log below). In fact, nothing was copied, this was just a test of the script. Is there a way to get the actual amount of data "copied" during a smart update?

PARTIAL LOG:

|11:19:38 AM|Info| Scanned 7163 items occupying 157.93 GB (496 directories, 6667 files, 0 symlinks)
|11:19:38 AM|Info| Copied 2 items totaling 6.64 GB (1 directories, 1 files, 0 symlinks)
|11:19:38 AM|Info| Cloned 6.64 GB of data in 2 seconds at an effective transfer rate of 3401.39 MB/s
|11:19:38 AM|Info| PHASE: Conclude Target Setup
|11:19:38 AM|Info| ...ACTION: Bless System on Music
|11:19:38 AM|Info| ......COMMAND => Blessing OS X System Folder
|11:19:38 AM|Info| Did not bless Mac OS X System Folder on Music because it does not exist.
|11:19:38 AM|Info| ......COMMAND => Blessing OS 9 System Folder
|11:19:38 AM|Info| Did not bless Mac OS 9 System Folder on Music because it does not exist.
|11:19:38 AM|Info| ...ACTION: Execute Site Customization Script /Applications/Utilities/SuperDuper/Extras/disable_spotlight
|11:19:38 AM|Info| ......COMMAND => Invoking site customization script: /Applications/Utilities/SuperDuper/Extras/disable_spotlight
|11:19:38 AM|Info| Disabling spotlight for /Volumes/Music...
|11:19:38 AM|Info| /Volumes/Music:
|11:19:38 AM|Info| Volume index removed.
|11:19:38 AM|Info| Indexing disabled for volume.
|11:19:38 AM|Info| Copy complete.

END PARTIAL LOG

dnanian
07-27-2005, 07:39 PM
Yep. We show the size of the data scanned, not the size of the data copied. We know: it *might* change in the future... but for now you can only get a count, and not the size.