Hello,
I am using rsync at Mac OS X for synchronizing
pictures for our two offices. Unfortunatelly yesterday
the script stops working. Here is little workarround.
The script select every file from folder A and write
it to PENDING-FILES file. Than RSYNC take from
PENDING-FILES every line (file) and transfer to folder
B on different machine. Unfortunately some Mac user
created folder started with "Bullet" symbol
(http://en.wikipedia.org/wiki/%E2%80%A2) (e.g.
<bullet><space>New<space>Pictures) and the script
stops and nothing is transfered. Is something wrong
with script or RSYNC ? (see bellow complete script).
Thanks for help in advance.
Jason
#!/bin/bash -x
in="/Volumes/Pictures/Photos"
out="user@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" ];
then
echo -n "-- Parsing $i"
if [ ! -s .pending_files ];
then
echo "Pending:" > .pending_files
fi;
if [ $(grep -c "$i" .pending_files) = "0" ];
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
mv .pending_files_new .pending_files
fi;
fi;
else
echo -n "-- File $i is in use" | logger
fi;
done
exit 0
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
On Tue, 2007-08-14 09:56:02 -0700, Michael Reynolds <neufurth_bernd@yahoo.com> wrote:> #!/bin/bash -xLooking at the execution flow (requested by -x) you'd probably already be able to locate the problem.> in="/Volumes/Pictures/Photos" > out="user@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_newDito.> mv .pending_files_new .pending_files > fi; > fi; > else > echo -n "-- File $i is in use" | logger > fi; > done > exit 0Bad. Here, you don't know if operation was all that successfull at all. MfG, JBG -- Jan-Benedict Glaw jbglaw@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