The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - Newcomers (http://hintsforums.macworld.com/forumdisplay.php?f=15)
-   -   What's Wrong With This Shell Script? (http://hintsforums.macworld.com/showthread.php?t=113131)

mnewman 07-28-2010 09:23 PM

What's Wrong With This Shell Script?
 
I'm trying to write a Postflight shell script for Carbon Copy Cloner that will:

1 - Unmount the backup drive

2 - Write the result to the CCC log file

3 - Send e-mail consisting of the last 50 lines of the CCC log file

Here's the script. It's actually one line in the script, but I broke it up here for easier reading:

Code:

#!/bin/sh
(sleep 60; diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >>
 /Library/Logs/CCC.log 2>&1; sleep 60; tail -n 50  /Library/Logs/CCC.log |
 mail -s "CCC" root) &

1 & 2 work fine, but the e-mail never gets sent.

If I run the shell script from the command line, it works fine: It unmounts the drive, writes to the CCC log file and sends e-mail.

But, when run as a CCC Postflight shell script, the last part always fails.

Any ideas?

acme.mail.order 07-28-2010 10:52 PM

Try /usr/bin/mail at the end.

mnewman 07-28-2010 11:52 PM

Quote:

Originally Posted by acme.mail.order (Post 591219)
Try /usr/bin/mail at the end.

Thanks, but that didn't work. Here's a fragment of the CCC log. You can see that the Posflight script has been run and that the unmount command was successful. But, the mail is never sent:

Code:

07/29 10:41:31        Running postflight script: /usr/share/Clone.sh
07/29 10:41:31        Updating the dynamic linker shared cache
07/29 10:41:31        Summary statistics:
        Data copied: 980.89 MB [Please see http://www.bombich.com/software/docs/CCC/en.lproj/troubleshooting/log.html for a comment about this figure]
        Total data in file set: 195.54 GB
        Regular files copied: 330
        Directories: 218774
        Regular files: 852957
        Symlinks: 20011
        Devices: 0
        Special files: 42
        Hard links: 34458
        Extended attributes: 736982 (2.77 KB)

07/29 10:41:31        The backup operation has completed. Elapsed time: 00:17:41
================================================================================


Volume Clorox on disk1s2 unmounted
07/29 10:42:34        [INFO] Volume unmounted: "/Volumes/Clorox"


acme.mail.order 07-29-2010 12:11 AM

Try this:

Code:

#!/bin/sh
mylog=/var/log/myscript.log
echo $USER >> $mylog
echo 1 > $mylog

sleep 10
echo 2 >> $mylog

diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >>
/Library/Logs/CCC.log 2>&1
echo 3 >> $mylog

sleep 10
tail -n 50 /Library/Logs/CCC.log | /usr/bin/mail -s "CCC" root
echo 4 >> $mylog


mnewman 07-29-2010 02:20 AM

Thanks for the suggestion. I tried this:

Code:

#!/bin/sh
mylog=/var/log/myscript.log
echo $USER > $mylog
(sleep 60; diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >>
 /library/logs/CCC.log 2>&1;  sleep 120; echo beforemail >>
 $mylog; tail -n 50  /library/logs/CCC.log | /usr/bin/mail -s "CCC" root;
 echo mail  >> $mylog) &

(Again, the third line of the script is one long list run asynchronously.)

If I run this as a CCC Postflight shell script the log /var/log/myscript.log is completely empty, nothing in it at all.

If I run this script from the command line (as root) here's what's in the log:

Code:

root
beforemail
mail

Just what you'd expect if the script ran through to the end.

So, there's something about how this script runs as a CCC Postflight script that simply prevents some stuff from happening.

I don't get it.

acme.mail.order 07-29-2010 02:27 AM

Quote:

Originally Posted by mnewman (Post 591234)
(Again, the third line of the script is one long list run asynchronously.)

Perhaps that's your problem. What happens if you run it synchronously? I don't see any need for an asynchronous routine here, and 2 minutes is way longer than needed to let a log process finish.

mnewman 07-29-2010 02:34 AM

If I run it synchronously then it unmounts the drive before CCC is finished. This causes CCC to end with an error and a dialog box left on the screen. The author of CCC suggests the following:

Code:

(sleep 60; diskutil unmount "$2" >> /Library/Logs/CCC.log 2>&1)
&

and

Code:

(sleep 10; /usr/libexec/PlistBuddy -c "Print" /Library/Logs/CCC.stats | tail -n 9 | mail -s "CCC Scheduled Task Report" root) &
I just want to combine these into one script. If I put them in separate lists, then the second list runs before the first one has had a chance to write the results of the unmount command to the CCC.log. The "sleep" time doesn't seem to matter. Even if I put 'sleep 120' the second list executes before the first one is finished.

hayne 07-29-2010 02:46 AM

The parentheses () cause the commands to be run in a sub-shell.
I think what you want is to put all of the commands inside one set of parentheses.

mnewman 07-29-2010 02:51 AM

Thanks hayne. But, I've tried all in one set of parenthesis. If you look at the CODE in the OP, you'll see that it's all in one line. But, if I do that, the 'mail' command never gets executed if the script is run as a CCC postflight script.

But, if I run the exact same script from the command line, then the mail command does get executed.

hayne 07-29-2010 02:57 AM

Start by using full paths for all executables and files referred to in the script.
E.g. "/usr/bin/tail" instead of "tail"

acme.mail.order 07-29-2010 03:02 AM

We've been there. mail is the issue, not tail. mail will still deliver an empty message. Still, full paths remove the question.

What happens when you replace the mail command with a file write? This will say once and for all if it's mail or something else that's misbehaving.

..... | /usr/bin/tail -n 9 > /var/log/myoutput.txt

hayne 07-29-2010 03:15 AM

Quote:

Originally Posted by acme.mail.order (Post 591243)
We've been there. mail is the issue, not tail. mail will still deliver an empty message.

I haven't been following this thread, but upon reading it quickly I don't see that it has been established that 'mail' is running at all. In fact an earlier post (with the 'echo'ing to the log) seemed to indicate that the script wasn't running at all.

Quote:

Still, full paths remove the question.
Exactly. At the first sign of trouble with a script, you should do two things:
- use full paths for everything
- insert logging statements (writing to a file) after each command

mnewman 07-29-2010 03:31 AM

OK. I just combined the script into one long list to be run asynchronously. I ran it from the command line. I got e-mail with the last 50 lines of CCC.log. Everything works exactly right if I run the script from the command line like this:

Code:

sudo ./Clone.sh
But, when I run it as a CCC Posflight script the only part that doesn't work is the mail command:

The 'unmount' command works!

The write to the CCC.log file works!

acme.mail.order 07-29-2010 03:31 AM

He says, up in #1, that the script runs fine from the command line. So either something is killing the background job (difficult) or it's failing before the final step.

mnewman: something else to throw in. Replace the `tail` part with a simple echo command to test the mail function.

After re-reading #5 and #7 I'm thinking it's still a timing error that will be solved with synchronous coding. Waiting x seconds for an unrelated process to stop is just a lot of guesswork, we should have a way to test, definitively, when it's ready to go. Mike Bombich knows his stuff - there must be a better solution than 'wait a while and hope'.

hayne 07-29-2010 03:38 AM

Quote:

Originally Posted by acme.mail.order (Post 591249)
He says, up in #1, that the script runs fine from the command line. So either something is killing the background job (difficult) or it's failing before the final step.

The script might run fine from the command line but fail miserably in some other environment (like that provided by CCC) if the script makes any assumptions at all about its environment. A common difference is that the execution PATH is different from that used on the command line. And aliases etc are not operative - since the shell set up files (dot files) are (often) not used in other environments.

mnewman 07-29-2010 03:46 AM

OK. I've put full paths for all of the commands. I have replaced 'mail' with a simple 'tail' that writes the last 50 lines of the CCC.log file to an now-empty log file. It works from the command line. I'll try it now with CCC.

Here's the one line list of commands:

Code:

(/bin/sleep 60; /usr/sbin/diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >> /library/logs/CCC.log 2>&1 ; /bin/sleep 120; /usr/bin/tail -n 50  /library/logs/CCC.log > /var/log/myscript.log) &

acme.mail.order 07-29-2010 03:46 AM

My thoughts exactly- that's the usual cause but doesn't seem to be the main culprit here. Hence full paths and some script step logging.

mnewman 07-29-2010 03:51 AM

I tried this:

Code:

#!/bin/sh
mylog=/var/log/myscript.log
echo $USER > $mylog
echo `date` >> $mylog
(sleep 60; diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >> /library/logs/CCC.log 2>&1) &
echo beforemail >> $mylog
echo `date` >> $mylog
(sleep 120; echo duringmail >> $mylog; echo `date` >> $mylog; tail -n 50  /library/logs/CCC.log | /usr/bin/mail -s "CCC" root) &
echo aftermail >> $mylog
echo `date` >> $mylog

The first two 'echo' statements ($USER and date) never made it into /var/log/myscript.log

The order of the other echo statements was:

1 - beforemail + date

2 - aftermail + date

3 - duringmail + date

But, if I ran the above from the command line, all of the echos made it into the log file.

mnewman 07-29-2010 04:12 AM

Quote:

Originally Posted by mnewman (Post 591252)
OK. I've put full paths for all of the commands. I have replaced 'mail' with a simple 'tail' that writes the last 50 lines of the CCC.log file to an now-empty log file. It works from the command line. I'll try it now with CCC.

Here's the one line list of commands:

Code:

(/bin/sleep 60; /usr/sbin/diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >> /library/logs/CCC.log 2>&1 ; /bin/sleep 120; /usr/bin/tail -n 50  /library/logs/CCC.log > /var/log/myscript.log) &

OK, ran the above as a CCC Postflight script. Everything worked except the write to /var/log/myscript.log.

mnewman 07-29-2010 05:36 AM

This is my old CCC Postflight script:

Code:

#!/bin/sh
mdutil -i off /Volumes/Clorox/ | mail -s "MDS Off" root
echo "Clone Bleach ran" | mail -s "Clone Bleach" root

It always worked just fine. So, we know that the 'mail' command can work when a script is run as a CCC Postflight script.

hayne 07-29-2010 09:24 AM

I understand that you've been running this script from the command-line as 'root'.
Are you sure that the CCC environment runs the script as 'root' ? If not, permission problems are an obvious thing to look at.

mnewman 07-29-2010 06:14 PM

I've tried running it both as "me" and as root. Should I try running it as some other user?

Kyd 07-30-2010 07:56 AM

I don't really think it'll help, but I would try the code without the trailing & as that seems to be the only difference between the older working and the current non-working code.

The problem isn't in mail directly as you've demonstrated merely tailing the contents into a file doesn't work.

The other difference is when you run the code manually, there is a controlling terminal. When run via Postflight, there isn't. Maybe a nohup is needed.

mnewman 07-30-2010 07:19 PM

This has to be run with the trailing & because it has to run asynchronously. Otherwise the disk gets unmounted before CCC is finished causing CCC to exit with an error.

Where would the 'nohup' go?

mnewman 07-30-2010 08:03 PM

It Finally Works
 
Here's the version that works:

Code:

(sleep 60; diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >> /library/logs/CCC.log 2>&1; sleep 10; tail -n 25  /library/logs/CCC.log | mail -s "CCC" root) &
The only thing I can see that is different from the versions that didn't work is the length of the second 'sleep' command; ten seconds instead of 60 or 120.

Oddly, although this script works, it fails to unmount the disk:

Code:

07/31 06:56:54        Running postflight script: /usr/share/Clone.sh
07/31 06:56:54        Updating the dynamic linker shared cache
07/31 06:56:54        Summary statistics:
        Data copied: 6.91 GB [Please see http://www.bombich.com/software/docs/CCC/en.lproj/troubleshooting/log.html for a comment about this figure]
        Total data in file set: 192.39 GB
        Regular files copied: 10504
        Directories: 218863
        Regular files: 853622
        Symlinks: 20033
        Devices: 0
        Special files: 44
        Hard links: 34458
        Extended attributes: 736088 (546.59 MB)

07/31 06:56:55        The backup operation has completed. Elapsed time: 00:25:51
================================================================================


Volume Clorox on disk1s2 failed to unmount


Kyd 07-31-2010 08:38 AM

Quote:

Originally Posted by mnewman (Post 591452)
This has to be run with the trailing & because it has to run asynchronously. Otherwise the disk gets unmounted before CCC is finished causing CCC to exit with an error.

Where would the 'nohup' go?

The only thing the & is doing in this case is making the shell script return immediately while everything else happens in the background synchronously. I've broken the code down to be more readable:

(
sleep 60;
diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >> /library/logs/CCC.log 2>&1;
sleep 10;
tail -n 25 /library/logs/CCC.log | mail -s "CCC" root
) &

The & is clearly outside the () and is just putting everything inside the () in the background. The first thing happening is the program sleeps for 60 seconds for no apparent reason. AFTER sleeping, it unmounts the drive putting both stdout and stderr into your log file. I would really expect diskutil to NOT return until it has finished, but a short sleep can't hurt.

You said this worked, but failed to unmount the drive. Did you have anything else open on the drive when you ran the script?.

When you were testing it before, were you waiting 3 minutes for all the sleeps to expire before deciding it hadn't worked?

The nohup would go at the top of script right below the opening line, but I don't think now that is your problem.

mnewman 07-31-2010 07:40 PM

Quote:

Originally Posted by Kyd (Post 591500)
The first thing happening is the program sleeps for 60 seconds for no apparent reason.

Have a look here for the reason: Mounting a volume before a scheduled task and unmounting a volume after the scheduled task

Quote:

Originally Posted by Kyd (Post 591500)
You said this worked, but failed to unmount the drive. Did you have anything else open on the drive when you ran the script?.

Nothing.

Quote:

Originally Posted by Kyd (Post 591500)
When you were testing it before, were you waiting 3 minutes for all the sleeps to expire before deciding it hadn't worked?

Yes.

CCC ran as a scheduled task last night. From the log file you can see that the postflight script ran. But, it neither unmounted the drive nor sent e-mail. This is driving me nuts:

Code:

08/01 04:05:43        Running postflight script: /usr/share/Clone.sh
08/01 04:05:44        Updating the dynamic linker shared cache
08/01 04:05:44        Summary statistics:
        Data copied: 18.10 GB [Please see http://www.bombich.com/software/docs/CCC/en.lproj/troubleshooting/log.html for a comment about this figure]
        Total data in file set: 192.23 GB
        Regular files copied: 794
        Directories: 218894
        Regular files: 853200
        Symlinks: 20033
        Devices: 0
        Special files: 43
        Hard links: 34458
        Extended attributes: 736046 (4.67 KB)

08/01 04:05:44        The backup operation has completed. Elapsed time: 00:35:34
================================================================================


acme.mail.order 07-31-2010 07:54 PM

Why not simply eliminate the problem entirely? Skip the CCC postflight step and do the entire job as a regular shell script. CCC is little more than a wrapper around a couple of commands like hdiutil and rsync - duplicating it's functionality in a shell script is very easy.

mnewman 07-31-2010 08:00 PM

Quote:

Originally Posted by acme.mail.order (Post 591535)
Why not simply eliminate the problem entirely? Skip the CCC postflight step and do the entire job as a regular shell script. CCC is little more than a wrapper around a couple of commands like hdiutil and rsync - duplicating it's functionality in a shell script is very easy.

I wouldn't have the slightest idea where to begin.

If I don't even have the brains to get a one line shell script to run I can't imagine doing something as complex as cloning a drive. Remember, this is the "Unix Newcomers" subforum…..

acme.mail.order 07-31-2010 08:09 PM

Cloning a drive is easy! And you've already worked out some essential concepts.

But lets back up a bit - what is your primary goal? A bootable backup or a restorable image?

Is this on a personal machine or on a server?

mnewman 07-31-2010 08:38 PM

This is on our main personal machine. My goal is a bootable backup. I run CCC automatically once a week. I want to be notified via e-mail that CCC ran. I want to have the backup drive mount only on demand and unmount when CCC is done.

I want the backup drives (CCC and Time Machine) to be unmounted when not in use because it makes a significant improvement in the speed of loading file dialog boxes.

acme.mail.order 07-31-2010 09:06 PM

The bootable backup portion of CCC will do something like this:
(note carefully the spacing around the single / )

rzync -aqAXx --del --log-file=/var/log/myrsync.log / /Volumes/backupVolume

As for the mount/unmount part, Bombich does some fancy things to hide the process from the Finder - no need to duplicate.

To mount an unmounted volume we need to find it's device name, diskutil plus some string massaging:

Code:

mountThis=`diskutil list | grep iWantThisVolume | sed -e 's/.*disk\([0-9].*\)/disk\1/'`
diskutil mount $mountThis

Everything else can be run syncrounously entirely in the background. Get Lingon to create an auto-launch background job.

mnewman 07-31-2010 09:16 PM

AMO - Thanks for this. I will have a look and see what I can do. Right now the monitor for that machine (a MacMini) is in for repairs and I'm doing everything via VNC from an ancient iMac. When I get the monitor back I'll give it a shot.

I'm still curious as to why the script in the OP doesn't work as expected.

acme.mail.order 07-31-2010 09:18 PM

Why don't you enable remote login on the Mini and use Terminal and ssh? Much faster than VNC to the other desktop then using Terminal there.

mnewman 07-31-2010 09:23 PM

Good idea. I've got SSH enabled with public key authentication.

Kyd 08-02-2010 07:00 AM

The long standing way to make sure disk io was completed in the past was to issue "sync; sync; sync", not sleeping and hoping it magically got done. I'd be hard pressed to believe that no longer works on a system that is "certified unix".

mnewman 08-02-2010 08:51 PM

Quote:

Originally Posted by Kyd (Post 591662)
The long standing way to make sure disk io was completed in the past was to issue "sync; sync; sync", not sleeping and hoping it magically got done. I'd be hard pressed to believe that no longer works on a system that is "certified unix".

I tried this:

Code:

mdutil -i off /Volumes/Clorox/ | mail -s "MDS Off" root
sync; sync; sync
(sleep 60; diskutil unmount 02352EBA-9C0A-3992-AA28-BBCBC7A29367 >> /library/lo$

Both e-mail messages got sent, but the drive still failed to unmount:

Code:

Volume Clorox on disk1s2 failed to unmount
I thought the unmount failure might be because mds was trying to index the clone, so I turned indexing off. Obviously, that didn't work. Neither did the sync; sync; sync…

There can be nothing using this volume as it is not mounted until just before CCC runs. No other process uses the volume.

I remain baffled.

hayne 08-03-2010 01:24 AM

You might try using 'lsof' to check for open files on that volume.

mnewman 08-03-2010 01:42 AM

Quote:

Originally Posted by hayne (Post 591725)
You might try using 'lsof' to check for open files on that volume.

Here it is:

Code:

notifyd      26          root  15r      DIR      14,5      7412  607655 /Volumes/Clorox/System/Library/Extensions
notifyd      26          root  17r      REG      14,5  18661932  1104465 /Volumes/Clorox/mach_kernel
notifyd      26          root  18r      REG      14,5      290  509287 /Volumes/Clorox/Library/Preferences/SystemConfiguration/com.apple.Boot.plist
notifyd      26          root  19r      REG      14,5  9111563  1222921 /Volumes/Clorox/System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext
notifyd      26          root  20r      REG      14,5    319152  579219 /Volumes/Clorox/System/Library/CoreServices/boot.efi
notifyd      26          root  21r      DIR      14,5      1258        2 /Volumes/Clorox
notifyd      26          root  22r      REG      14,5      479  1121616 /Volumes/Clorox/System/Library/CoreServices/SystemVersion.plist
notifyd      26          root  24r      REG      14,5      389  1232522 /Volumes/Clorox/System/Library/CoreServices/.disk_label
mds          62          root    7r      DIR      14,5      1258        2 /Volumes/Clorox
mds          62          root  40r      DIR      14,5      1258        2 /Volumes/Clorox
Path\x20F  307        mnewman  642r      DIR      14,5        68  1232530 /Volumes/Clorox/.Trashes/501
kextd    14931          root    5r      REG      14,5      1575  1104403 /Volumes/Clorox/usr/standalone/bootcaches.plist
grep      97391        mnewman    1w      REG      14,2        0 52540728 /Users/mnewman/Clorox.txt


mnewman 08-03-2010 09:34 PM

This is too weird. If I put 'sleep 60' as follows:

Code:

(sleep 60; diskutil unmount "$2" >> /Library/Logs/CCC.log 2>&1; sleep 1; tail -n 25  /Library/Logs/CCC.log | mail -s "CCC" root) &
unmount FAILS
mail SUCCEEDS

If I put 'sleep 120' as follows:

Code:

(sleep 120; diskutil unmount "$2" >> /Library/Logs/CCC.log 2>&1; sleep 1; tail -n 25  /Library/Logs/CCC.log | mail -s "CCC" root) &
unmount SUCCEEDS
mail FAILS

Here's what was happening with the volume (lsof) just before the 'sleep' command:

Code:

notifyd      26          root  15r      DIR      14,5      7412  607655 /Volumes/Clorox/System/Library/Extensions
notifyd      26          root  17r      REG      14,5  18661932  1104465 /Volumes/Clorox/mach_kernel
notifyd      26          root  18r      REG      14,5      290  509287 /Volumes/Clorox/Library/Preferences/SystemConfiguration/com.apple.Boot.plist
notifyd      26          root  19r      REG      14,5  9111563  1222921 /Volumes/Clorox/System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext
notifyd      26          root  20r      REG      14,5    319152  579219 /Volumes/Clorox/System/Library/CoreServices/boot.efi
notifyd      26          root  21r      DIR      14,5      1258        2 /Volumes/Clorox
notifyd      26          root  22r      REG      14,5      479  1121616 /Volumes/Clorox/System/Library/CoreServices/SystemVersion.plist
notifyd      26          root  24r      REG      14,5      389  1234254 /Volumes/Clorox/System/Library/CoreServices/.disk_label
mds          62          root    7r      DIR      14,5      1258        2 /Volumes/Clorox
mds          62          root  49r      DIR      14,5      1258        2 /Volumes/Clorox
Path\x20F  307        mnewman  643r      REG      14,2      1544 52540728 /Users/mnewman/Clorox.txt
Path\x20F  307        mnewman  664r      DIR      14,5        68  1233691 /Volumes/Clorox/.Trashes/501
kextd    14931          root    5r      REG      14,5      1575  1104403 /Volumes/Clorox/usr/standalone/bootcaches.plist
update_dy 66559          root  txt      REG      14,5  8405696  1121813 /Volumes/Clorox/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

Anything there that would keep the volume from unmounting?

hayne 08-03-2010 11:40 PM

I think any open file (or folder) will keep the volume from unmounting. Each of the lines you showed from 'lsof' indicates an open file ("REG") or folder ("DIR").
The first entry in each line is the program that has opened the file/folder.
I assume that "Path\x20F" is Path Finder.

mnewman 08-04-2010 02:40 AM

You're right. It is PathFinder. But, I never have trouble manually unmounting the volume, even if PathFinder has it displayed in the sidebar under 'Devices'.

I may have overcome, if not solved the problem. I tried setting the 'sleep' time to 90 as follows:

Code:

(sleep 90; diskutil unmount "$2" >> /Library/Logs/CCC.log 2>&1; sleep 1; tail -n 25  /Library/Logs/CCC.log | mail -s "CCC" root) &
And, the volume was unmounted and the e-mail went out. I guess 60 was too short and 120 too long. I have no idea why. How could the extra 30 seconds cause the final command in the list to fail?

From the CCC.log fragment that was the body of the e-mail:

Code:

08/04 09:02:54        Blessing the target volume...
08/04 09:02:56        Running postflight script: /usr/share/Clone.sh
08/04 09:03:44        Updating the dynamic linker shared cache
08/04 09:03:44        Summary statistics:
        Data copied: 2.52 GB [Please see http://www.bombich.com/software/docs/CCC/en.lproj/troubleshooting/log.html for a comment about this figure]
        Total data in file set: 190.45 GB
        Regular files copied: 1619
        Directories: 218922
        Regular files: 849285
        Symlinks: 20033
        Devices: 0
        Special files: 45
        Hard links: 34457
        Extended attributes: 729332 (9.63 KB)

08/04 09:03:44        The backup operation has completed. Elapsed time: 00:23:15
================================================================================


Volume Clorox on disk1s2 unmounted
08/04 09:05:17        [INFO] Volume unmounted: "/Volumes/Clorox"

I guess it will forever remain a mystery. Unless, of course, it fails again tomorrow…

mnewman 08-06-2010 07:11 PM

What is update_dy?
 
Which it did. This morning the Volume failed to unmount. I did an lsof of the volume immediately after the sleep command:

Code:

(sleep 90; lsof | grep "$2" > /private/var/log/clorox.log; diskutil unmount "$2" >> /Library/Logs/CCC.log 2>&1; sleep 1; tail -n 25  /Library/Logs/CCC.log | mail -s "CCC" root) &
and it is absolutely full of stuff like this:

Code:

update_dy 79091          root  txt      REG      14,5    214672  628111 /Volumes/Clorox/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
update_dy 79091          root  txt      REG      14,5    42464  626373 /Volumes/Clorox/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
update_dy 79091          root  txt      REG      14,5    136976  626932 /Volumes/Clorox/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
update_dy 79091          root  txt      REG      14,5  3686320  1126038 /Volumes/Clorox/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv

What is update_dy? I can't find a reference to it.

hayne 08-06-2010 07:52 PM

Code:

% man -k update_dy
update_dyld_shared_cache(1) - Updates dyld's shared cache


mnewman 08-06-2010 07:59 PM

Thanks hayne. I tried both 'man' (without the switch) and 'which' on 'update_dy' and, of course, came up with nothing.

I'm assuming that this is running on the newly blessed clone and that the volume cannot unmount until this is done?


All times are GMT -5. The time now is 10:39 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.