Skip to main content

Posts

Showing posts from June 16, 2011

Rsync multiple files, folders

Needed to rsync the 3 folders.
So the script to do that is as follows ("rsync_backup")
It requires the key named "23.pub" to be appended in "~/.ssh/authorized_keys" and
in crontab -e "*/1 * * * * /var/www/repositories/rsync_backup"
It will backup every minute

/*********************************************************************/
#!/bin/sh

RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
KEY=/home/quickstart/.ssh/23
RUSER=quickstart
RHOST=172.20.1.139
RPATH1=/var/www/repositories/
LPATH1=/var/www/repositories/repos/
RPATH2=/var/www/icode/
LPATH2=/var/www/repositories/icode/
RPATH3=/home/git/repositories/
LPATH3=/var/www/repositories/git/


$RSYNC -az -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH1 $LPATH1
$RSYNC -az -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH2 $LPATH2
$RSYNC -az -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH3 $LPATH3