LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How can I stop rsync from deleting data if network link is dropped? (https://www.linuxquestions.org/questions/linux-networking-3/how-can-i-stop-rsync-from-deleting-data-if-network-link-is-dropped-199482/)

skyfly 06-30-2004 10:03 AM

How can I stop rsync from deleting data if network link is dropped?
 
I run rsync as a cron job on a Slackware 9 box. I use smbmount to mount a Windows share and then sync data using rsync with the --delete switch. Sometimes the connection drops while rsync is still running, resulting in the rest of the data being deleted. Is there a way of stopping this to happen? My script looks like this:

umount /mnt/new_projects
smbmount //192.168.0.12/repl /mnt/new_projects -o username=tux%penquin
if [ $? = 0 ]
then
rsync -a -t -r -u -z \
--modify-window=10 \
--ignore-errors \
-v --progress \
--timeout=0 \
--stats \
--delete \
--include "*/" \
--include "*.par" \
--include "*.asm" \
--include "*.cfg" \
--exclude "*" \
--exclude "Visualization/" \
/mnt/new_projects/ "/disk1/Projects"
umount /mnt/new_projects
chmod -R 777 /disk1/Projects
echo Finished at &date
exit 1
else
echo "Could not mount $sharename on $ip"
echo "Rsync did not transfer any data at this time."
exit 1
fi

homey 06-30-2004 10:21 AM

How about --delete-after

skyfly 06-30-2004 10:35 AM

Rsync
 
Thanks. I read up on it, but many people seems to have a problem with it. However, I will try it on my side and see what it does.


All times are GMT -5. The time now is 11:14 PM.