| 35 | * [解法] 一勞永逸法 - 因為每次跑 drblpush 或跑 re-deploy 的時候都會改掉 /etc/hosts,比較好的方法還是 patch drbl 的 script |
| 36 | {{{ |
| 37 | #!diff |
| 38 | --- drbl-etc-hosts.org 2010-08-03 18:03:13.000000000 +0800 |
| 39 | +++ drbl-etc-hosts 2010-08-03 18:03:31.000000000 +0800 |
| 40 | @@ -48,7 +48,7 @@ |
| 41 | srv_ip="$(drbl-get-ipadd $interface)" |
| 42 | if grep -q -E "^$srv_ip[[:space:]]+" $HOSTS_OUT; then |
| 43 | # found the old one, replace that |
| 44 | - perl -pi -e "s|^$srv_ip.*|$srv_ip ${hostname_prefix}-$interface|g" $HOSTS_OUT |
| 45 | + perl -pi -e "s|^$srv_ip.*|$srv_ip ${hostname_prefix}-$interface $(hostname)|g" $HOSTS_OUT |
| 46 | else |
| 47 | # old one does not exist, create one |
| 48 | cat <<-EOF >> $HOSTS_OUT |
| 49 | }}} |