rsync backup
Work in progress! This is not the final text yet.
syntax:
rsync -ruvz -e ssh user@host:/remote/dir /local/dir/
ssh key exchange, chose no passphrase
ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/user/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user/.ssh/id_rsa. Your public key has been saved in /home/user/.ssh/id_rsa.pub. The key fingerprint is: 27:4c:6d:cf:4c:c8::13:22:70:f6:61:a8:35:cf:a0:23 user@localhost
~/.ssh/id_rsa.pub
ssh-rsa G9BjydOJPGH0RFNAy1QqIWBGWv7vS5K2tr+EEO+F8WL2Y/jK4ZkUo+n7DWQV AAAAB3NzaC1yc2EAAAABIwAAAIEArkwv9X8eTVK4F7pMlSt45pWoiakFkZMwOHsRQgoi ijcS3LvtO+50Np4yjXYWJKh29JL6GHcp8o7+YKEyVUMB2CSDOP99eF9g5Q0d+1U2WVdB WQM= user@host
Copy to remote server's ~/.ssh/authorized_keys
crontab script:
#!/bin/sh
rsync=/usr/bin/rsync
ssh=/usr/bin/ssh
ruser=user
rhost=host
rdir=/remote/dir
ldir=/local/dir/
${rsync} -ruvz -e ${ssh} ${ruse}r@${rhost}:${rdir} ${ldir} > /var/log/rsync_backup.log
crontab -e
0 1 * * * rsync_backup.sh
edit /etc/newsyslog
/var/log/rsync_backup.log root:wheel 644 3 * $W0D1 JB
/etc/rc.d/newsyslog restart
Work in progress! This is not the final text yet.