1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
1. On the Source Server generate an RSA key for use by ssh: > ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa 2. Copy the contents of /root/.ssh/id_rsa.pub on the Source Server to /root/.ssh/authorized_keys on the Destination Server. Make sure that there are no line breaks in the copied key. 3. On the Source Server, verify that you can login to the Destination Server via ssh without a password: > ssh -l root {ip of dest server} 4. On the Destination Server, create a directory to store the backup data: > mkdir /backups/mail Make sure that the selected location has sufficient available storage to accomdate the backup. 5. On the Source Server, create a script similar to: #!/bin/bash DEST=root@172.16.11.12:/backups/mail OPTIONS="-e ssh --checksum --partial --delete --verbose --progress --archive --links" SRC=/etc rsync $OPTIONS $SRC $DEST SRC=/home rsync $OPTIONS $SRC $DEST SRC=/var/spool/mail rsync $OPTIONS $SRC $DEST SRC=/var/www rsync $OPTIONS $SRC $DEST Modify the script as needed to copy the appropriate directory trees. The script can be placed in /usr/local/sbin/dobackups.sh and should be made executable with: > chmod 755 /usr/local/sbin/dobackups.sh 6. Add a cron job to run the script on a nightly basis. On RedHat we can place a file named "backups" into /etc/cron.daily with the contents: #!/bin/sh renice +19 -p $$ >/dev/null 2>&1 /usr/local/sbin/dobackups.sh Make the file executable with: > chmod 755 /etc/cron.daily/backups |