10/16/15

Rsync + SSH + Cron

Ssh-keygen generates keys:
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.200.10

Creae sh file:
#!/bin/bash
rsync -avuz /var/www/example.com/ root@192.168.200.10:/var/www/example.com/

a - archive mode
v - increase verbose
u - skip files that are newer on the receiver
z - compress file data during the transfer

Edit crontab:
run crontab -e and add:
*/5 * * * * /home/ramesh/backup.sh


No comments:

Post a Comment