PDA

View Full Version : Where is the log file stored?


pwharff
12-06-2005, 07:09 PM
I have SuperDuper running on a OS X server about 1000 miles away. Most of the maintenance and other misc. tasks I do through the terminal. Since I just started using SuperDuper (in place of ChronoSync and CCC), I want to monitor it closely until it gains my full and complete trust. So I want to make sure that my scheduled backups are actually occurring, so what would be the best way of verifying this:

1) Maybe through the log file??? Where is it?
2) Maybe some UNIX command line that will show me the last time a drive was touched??? How?
3) Maybe SuperDuper has a way of notifying the user when a particular Backup succeeded or failed???

Anyway, I just want to get feedback on what's the best approach to this?

dnanian
12-06-2005, 07:43 PM
The log file is stored in the settings package for the given scheduled copy, stored in Library/Application Support/SuperDuper!/Scheduled Copies. You'll find the logs inside the appropriate package, in the Logs folder.

If you want it to notify you when the copy happens, I'd suggest modifying the "Copy Job" script you'll find in the same package. Edit the entries at the top to do whatever you'd like for notification (you can even use "path to me" to find the location of the logfiles and the like).

Then, uncheck and re-check the schedule checkbox, and we'll compile the script for you.

Does that help?

pwharff
12-06-2005, 07:59 PM
I'm not sure it does help. I'm trying to accomplish this through the Terminal and the only thing I find that is "Cron Job" is a file called "Cron Job.app". So I'm not sure where to go from here.

dnanian
12-06-2005, 08:00 PM
You mean 'Copy Job.app'?

Parallel to that you should see a "Logs" folder. Go in that folder and you'll see the logs.

pwharff
12-06-2005, 08:18 PM
I found the Logs folder. I was responding to this statement of yours:

If you want it to notify you when the copy happens, I'd suggest modifying the "Copy Job" script you'll find in the same package. Edit the entries at the top to do whatever you'd like for notification (you can even use "path to me" to find the location of the logfiles and the like).

Now that I am looking at the Log file. Is it safe to assume that if the log says "Copy complete" as mine does, that the process complete WITHOUT any problems/errors? Meaning, would it ever say "Copy complete" and still have errors or problems with the copy?

Also, yes I meant "Copy Job".

dnanian
12-06-2005, 08:21 PM
No, it won't say "Copy complete" if there are problems -- it'll end with an error.

The previous statement is referring to the "Copy Job.applescript" you'll also find parallel to the Copy Job.app. The "app" is the compiled version.

pwharff
12-06-2005, 08:33 PM
Ahh, thanks a bunch! I think I'll write a shell script to look at the last line and verify if "Copy Complete" exisits. This would be reliable, right?

dnanian
12-06-2005, 08:39 PM
Well, it assumes we're not going to change the text -- which we shouldn't, but don't guarantee. It should work, though.

It might be easier to look at the .scheduleJobProperties file at the top of the package. This is a little XML file that'll tell you the last stop time, and also says whether or not the execution succeeded. Here's a snippet of one:


[g5:SuperDuper!/Scheduled Copies/Smart Update G5 from Macintosh HD.sdsp] dnanian% cat .scheduledJobProperties
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SDExitStatus</key>
<string>normal</string>
<key>SDLogFileName</key>
<string>/Users/dnanian/Library/Application Support/SuperDuper!/Scheduled Copies/Smart Update G5 from Macintosh HD.sdsp/Logs/2005-12-06 17:47:24 -0500.sdlog</string>
<key>SDScheduleStartTimestamp</key>
<date>2005-12-06T22:47:25Z</date>
<key>SDScheduleStopTimestamp</key>
<date>2005-12-06T23:53:01Z</date>


etc.

pwharff
12-07-2005, 01:04 PM
Thank you once again. One last question, what is the "0800" at the end of my log filename? Is this my GMT offset?

dnanian
12-07-2005, 01:08 PM
Yes, it is.

pwharff
12-07-2005, 01:51 PM
Not the best at shell scripting, but would this script be adequate:

head -6 .scheduledJobProperties | tail -2 | sed 's/\<key\>//g' | sed 's/\<\/key\>//g' | sed 's/\<string\>//g' | sed 's/\<\/string\>//g' | awk '{ print $1 }'

This assumes that the string "normal" is always the 6th line.

dnanian
12-07-2005, 02:09 PM
Looks about right to me!

pwharff
12-07-2005, 02:12 PM
Is the string for <key>SDExitStatus</key> always the 6th line?

dnanian
12-07-2005, 02:15 PM
At present. Of course, we can't guarantee that long term... it might be easier to use a grep expression to search for SDExitStatus, or just sed search for it in the file, since the value will always follow the key. That's be less dependent on the actual location.

pwharff
12-07-2005, 02:22 PM
Duh! You're right! This works much better:

grep -A 1 SDExitStatus .scheduledJobProperties | sed 's/\<key\>//g' | sed 's/\<\/key\>//g' | sed 's/\<string\>//g' | sed 's/\<\/string\>//g' | awk '{ print $1 }'

dnanian
12-07-2005, 06:22 PM
There ya go. :)

pwharff
12-07-2005, 09:31 PM
Ok, I have finally written my post backup script:

#!/bin/bash

#
# This script is intended to notify the Admin of backup status using Shirt Pockets SuperDuper! Success or Failure.
#

# Where to keep our log file
logPath=/var/log/backup-disk-usage

# Where is SD's .scheduledJobProperties file
statusPath=/private/var/root/Library/Application\ Support/SuperDuper\!/Scheduled\ Copies/Smart\ Update\ Backup1\ from\ Server.sdsp/.scheduledJobProperties

# Formatting of our log file
echo "<---- Backup Status for `date` ---->" >> "$logPath"
echo " " >> "$logPath"
echo "Drive Backed-up: Backup1" >> "$logPath"

# Find out status of SD's last backup. Success of Failure.
grep -A 1 SDExitStatus "$statusPath" | sed 's/\<key\>//g' | sed 's/\<\/key\>//g' | sed 's/\<string\>//g' | sed 's/\<\/string\>//g' | awk '{ print $1 }' >> "$logPath"

echo " " >> "$logPath"

# Include disk capacity info
df -ht hfs >> "$logPath"

echo " " >> "$logPath"

sleep 2

# Remotely copy to Apache HT docs dir using stored ssh key
scp /var/log/backup-disk-usage pwharff@noahprecision.com:/Library/WebServer/Documents/logs

Now I need to know how to run this shell script immediately after my scheduled backup and since I don't have direct access to this server (as mentioned above, over 1000 miles away) and no remote desktop connection or VNC, just Terminal, how would I do this?

dnanian
12-07-2005, 09:47 PM
Well, a few things I can think of.

First, set it to run with cron well after the start of the copy -- giving it long enough to work.

Second, you could use the "On successful completion" shell script in Advanced, but then it'd only run if successful.

Finally, you can run from the AppleScript using both of the two completion script blocks designed for this purpose (on afterRunningCopy and on errorRunningCopy). If you want to use the shell script, you'd use "do shell script" in there.

Note that you don't have to hardwire the backup path with this method, because "path to me" will give the path into the package (it'll actually be inside the Copy Job package)...

pwharff
12-08-2005, 02:08 PM
Thank you very very much for your feedback and help on this subject. I feel I have better control over my backups now, because of your help and your wonderful software. Hopefully somone could use our posts to this forum to help them as well! Thanks again and again and again!

--Paul

dnanian
12-08-2005, 02:27 PM
I hope it'll help others as well, but I'm happy to have helped you, Paul.