results of rsync script to firewire device when device is not attached

OS X 10.4.5, Powerbook
rsync  version 2.6.0  protocol version 27

I am running a cronjob nightly rsync script to an attached local firewire drive.  The name of the external volume is 'fibonacci'.  The script is:

* 3 * * 1 time rsync -a -b --suffix=# --backup-dir=buMonday /Users/cabenson /Volumes/fibonacci

Things are generally working as expected.  However, if the drive is not attached or mounted for some reason, the script will generate a new directory at the /Volumes/fibonacci location.

I attempt to remove that inadvertently generated directory with

rm -R /Volumes/fibonacci

When I do, I get a lot of 'Directory not empty' errors.  Sometimes  the rm -R process hangs as well.

Is there something unique about the directory tree that rsync is creating in /Volumes (when the ext firewire drive is mistakenly unattached) ?

Thanks
je
jesterepsilonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

brettmjohnsonCommented:
Test for the existence of the directory /Volumes/fibonacci first by prefacing the command with
[ -d /Volumes/fibonacci ] && 


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sda100Commented:
Hi there jesterepsilon

Assuming the directory is always going to be there (because you need it there to mount to), you can test for the mount instead, like so (you'll have to grep for the correct string though - this is just my example):

  mount | grep '/dev/scd0 on /media/rev type udf (rw)'
  RETVAL=$?
  if [ $RETVAL -eq 0 ] ; then
    # OK to proceed
    ...

Steve :)
0
gheistCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:

Split between brettmjohnson http:#16439937 and sda100 http:#16443928

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

gheist
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.