User login |
Keeping a central file repositoryI have multiple computers for which I would like to keep files in sync. My first toughts was to use the very useful tool Unison, which I used at other occasions. The problem with the DreamHost backup user is that this account is limited to use only ftp, sftp, rsync and/or rdist. So Unison was out of the question. So starting to look at rsync it was clear that rsync could not provide the same functions as Unison. What I ended up using was this small script. #!/bin/sh # DHostsync.sh # This script uses rsync to synchronize files between a local folder and a folder # on a server using rsync. # SERVER=remoteuser@server:/home/user/DHostsync/ LOCAL=/home/localuser/DHostsync/ COMMAND="$1" case $COMMAND in up) rsync -vaurP --delete $LOCAL $SERVER ;; down) rsync -vaurP --delete $SERVER $LOCAL ;; *) echo "This script should be run with the command up or down." echo "up - Uploads local changes to server." echo "down - Download files on server to local machine." ;; esac |