Rsync on Mac OS X

Jan-Benedict Glaw jbglaw at lug-owl.de
Tue Aug 14 17:44:06 GMT 2007


On Tue, 2007-08-14 09:56:02 -0700, Michael Reynolds <neufurth_bernd at yahoo.com> wrote:
> #!/bin/bash -x

Looking at the execution flow (requested by -x) you'd probably already
be able to locate the problem.

> in="/Volumes/Pictures/Photos"
> out="user at xxx.xxx.xxx.xxx:/Volumes/Pictures/Photos/"
> 
> echo "script called $0 $1 $2"
> 
> cd "$in"
> 
> for i in *
> do
>   if [ $(lsof | grep -c "$i") = "0" ];

Hopefully "$i" doesn't parse as a regex...

Also, grep is locale dependand... Maybe try it once without any
interpretation (lsof | LC_ALL=C grep -x .... ).

>   then
>    echo -n "-- Parsing $i"
> 
>    if [ ! -s .pending_files ];
>    then
>      echo "Pending:" > .pending_files
>    fi;
> 
>    if [ $(grep -c "$i" .pending_files) = "0" ];

Dito.

>    then
>     echo "$i" >> .pending_files
>     echo "sending $i"
>     rsync -vctzER -e ssh --timeout=600 --progress "$i" "$out"
>     if [ "$?" = "0" ];
>     then
>        echo "$i" >> .sent_files
>     else
>        echo -n "-- File $i transfer failed" | logger
>        grep -v "$i" .pending_files > .pending_files_new

Dito.

>        mv .pending_files_new .pending_files
>     fi;
>   fi;
>   else
>     echo -n "-- File $i is in use" | logger
>   fi;
> done
> exit 0

Bad. Here, you don't know if operation was all that successfull at
all.

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw at lug-owl.de              +49-172-7608481
Signature of:              Fortschritt bedeutet, einen Schritt so zu machen,
the second  :                   daß man den nächsten auch noch machen kann.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.samba.org/archive/rsync/attachments/20070814/2380996c/attachment.bin


More information about the rsync mailing list