Accessing Text in a Console Log

I do a nightly clone of my startup partition to another drive. I use CarbonCopyCloner with the log option selected, so every morning, front and center on my screen is a Console window “cccron.log” displaying the contents of /var/log/cccron.log. If the last line of this log says, as it did this morning: “Scheduled task complete: Wed Jun 22 03:22:08 ADT 2005”, then I quit the Console knowing that all went well in the wee hours (and periodically reboot into the clone to make sure all is as it should be).

I’d like to automate the Console check for the bottom line and then quit the Console application for inclusion with a suite of AppleScripts that I run from QuicKeys when I wake the machine in the morning (turning on lights and external speakers with a PowerKey bar, getting Growl notifications of exchange rates, upcoming birthdays, a server status, my router’s IP address, then changing settings in pmset, spinning up my hard disks, and starting Jiggler). [Jiggler prevents screensavers from activating on non-Apple displays that decide for themselves]. The Console is not scriptable.

How do I get that last line of text into an AS?

Try:

set last_line to (read ("/var/log/cccron.log" as POSIX file))'s paragraph -1

If the file is owned by root, you may have to use “with administrator privileges” and your password.

Jon

Apparently, I (running as an administrator) have read privileges - no PW fix required. Thanks. Turns out it’s
paragraph -3, but it’s there.