| 1 | = Rsync backup van alle user data met monitoring = |
| 2 | |
| 3 | * Fix een ssh key naar de server die je wilt backuppen: |
| 4 | {{{ |
| 5 | [Syn-3] root@backup.asdf.nl /etc/cron.daily# ssh-keygen |
| 6 | Generating public/private rsa key pair. |
| 7 | Enter file in which to save the key (/root/.ssh/id_rsa): |
| 8 | Enter passphrase (empty for no passphrase): |
| 9 | Enter same passphrase again: |
| 10 | Your identification has been saved in /root/.ssh/id_rsa. |
| 11 | Your public key has been saved in /root/.ssh/id_rsa.pub. |
| 12 | The key fingerprint is: |
| 13 | 88:15:b5:75:0e:ed:93:0a:1f:8f:36:78:55:d6:29:db root@backup |
| 14 | [Syn-3] root@backup.asdf.nl /etc/cron.daily# cat ~/.ssh/id_rsa.pub | ssh root@192.168.1.160 "cat >> ~/.ssh/authorized_keys" |
| 15 | root@192.168.1.160's password: |
| 16 | [Syn-3] root@backup.asdf.nl /etc/cron.daily# ssh root@192.168.1.160 |
| 17 | Last login: Tue Mar 3 12:44:06 2009 from 192.168.5.11 |
| 18 | Linux. |
| 19 | ... (inloggen zonder password nu mogelijk) |
| 20 | }}} |
| 21 | * Maak een user 'backup' op de backup server aan via de SCC |
| 22 | * Plaats dit script in /etc/cron.daily en pas het aan: |
| 23 | {{{ |
| 24 | NAME=emmen |
| 25 | IP=192.168.1.160 |
| 26 | if rsync -avx $IP:/home /home/users/backup; then |
| 27 | /sbin/syn3-state --force rsync-$NAME OK "mirror backup `date` gelukt" |
| 28 | else |
| 29 | /sbin/syn3-state --force rsync-$NAME ALERT "mirror backup `date` mislukt!" |
| 30 | fi |
| 31 | }}} |
| 32 | |
| 33 | Niet vergeten de x-bit te zetten! |
| 34 | |
| 35 | * Test het script: |
| 36 | {{{ |
| 37 | [Syn-3] root@backup.asdf.nl /etc/cron.daily# ./emmenbackup.sh |
| 38 | receiving file list ... done |
| 39 | home/shares/... |
| 40 | |
| 41 | }}} |