Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Use rsync as sync server for webdav server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 299
Location: Haarlem, Netherlands

PostPosted: Fri Apr 05, 2013 2:37 pm    Post subject: Use rsync as sync server for webdav server Reply with quote

On my server (Gentoo) I have a Webdav server installed. This is all working fine. On my laptop I have installed a cron file that syncs the server files with my local files. See below. Right now if a file is created on the server, that file is deleted after the sync because it is not on the laptop.
I would like rsync to copy new files to the local machine and if a file already exists to keep the newer file. Does anyone knows what option I could use for that?
Code:

#!/bin/sh

if [ ! -e /tmp/sync_documents.lock ]
        then
                PROG=$0
                RSYNC=/usr/bin/rsync
                SSH=/usr/bin/ssh
                KEY=<deleted for security reasons>
                RUSER=elmarotter
                RHOST=elmarotter.nl
                # DST
                RPATH=/mnt/dontpanic/Backup/Backup/arthurdent-new/Users/elmarotter/Documents/
                # SRC
                LPATH=/Users/elmarotter/Documents/

                # rsync options
                # -v increase verbosity
                # -a turns on archive mode (recursive copy + retain attributes)
                # -x don't cross device boundaries (ignore mounted volumes)
                # -E preserve executability
                # -S handle spare files efficiently
                # --delete delete deletes any files that have been deleted locally
                # --exclude-from reference a list of files to exclude
                touch /tmp/sync_documents.lock

                $RSYNC --verbose --progress --stats --compress \
                --recursive --times --perms --links --delete \
                --exclude-from=/Users/elmarotter/.sshkeys/rsync_documents_excludes.txt \
                -e "$SSH -i $KEY" $LPATH $RUSER@$RHOST:$RPATH
                echo "Documents Backup klaar" `date +%d-%m-%y`" "`date +%H:%M` >> /tmp/backup_documents-klaar

                if [ -e /tmp/sync_documents.lock ]
                        then
                                rm /tmp/sync_documents.lock
                fi
fi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum