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

Posted on 2006-04-12
Last Modified: 2010-04-21
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) ?

Question by:jesterepsilon
    LVL 23

    Accepted Solution

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

    LVL 9

    Assisted Solution

    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)'
      if [ $RETVAL -eq 0 ] ; then
        # OK to proceed

    Steve :)
    LVL 61

    Expert Comment

    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.

    EE Cleanup Volunteer

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now