1 |
On 5/16/05, Devraj Mukherjee <servers@××××××××××××××××××××.com> wrote: |
2 |
> I am in a situation where I am managing two Gentoo servers one of which |
3 |
> is the mirror of the other. I wish to mirror the two servers such that |
4 |
> one can be used as a replacement almost instantly if the other fails. |
5 |
> These servers are NOT available parallelly, its one or the other. |
6 |
|
7 |
I've done this with rsync, but I only synchronized configuration files: |
8 |
|
9 |
#!/bin/bash |
10 |
eval "$(emerge info | grep CONFIG_PROTECT)" |
11 |
set -x |
12 |
rsync -e 'ssh' -CavP --stats \ |
13 |
$( for d in ${CONFIG_PROTECT}; do |
14 |
[ -e ${d} ] && echo --include ${d}/ |
15 |
done) \ |
16 |
--include-from /etc/syncconfig/include \ |
17 |
$( for d in ${CONFIG_PROTECT_MASK}; do |
18 |
[ -e ${d} ] && echo --exclude ${d}; |
19 |
done) \ |
20 |
--exclude-from /etc/syncconfig/exclude \ |
21 |
--exclude '/*' \ |
22 |
--backup --backup-dir /var/config/$(date '+%Y-%m-%d') \ |
23 |
--delete --delete-after / ${1}:/ |
24 |
|
25 |
This leverages CONFIG_PROTECT and CONFIG_PROTECT_MASK from Portage, |
26 |
plus has two additional files to list manually excluded or included |
27 |
files, and keeps old configuration files in /var/config on the |
28 |
destination. |
29 |
|
30 |
-- |
31 |
Computer interfaces should never be made of meat. |
32 |
http://www.terrybisson.com/meat.html |
33 |
|
34 |
-- |
35 |
gentoo-server@g.o mailing list |