summaryrefslogtreecommitdiff
path: root/ctdb/config/ctdb-crash-cleanup.sh
diff options
context:
space:
mode:
authorMathieu Parent <math.parent@gmail.com>2011-11-25 21:12:43 +0100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2011-12-06 11:55:46 +1100
commit956f06f3ae5081e66d1c9461522db81f56cfb879 (patch)
treee3a75ec8ef874cd13a2d750515db068309a32dfd /ctdb/config/ctdb-crash-cleanup.sh
parent27a0414a5da22ac8f6fb616334c9e4efe5f4e5e1 (diff)
downloadsamba-956f06f3ae5081e66d1c9461522db81f56cfb879.tar.gz
Fix ctdb-crash-cleanup sysconfig handling
(This used to be ctdb commit 667b174d605646b53f4855e9aaf5f8ce4fdde532)
Diffstat (limited to 'ctdb/config/ctdb-crash-cleanup.sh')
-rwxr-xr-xctdb/config/ctdb-crash-cleanup.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/ctdb/config/ctdb-crash-cleanup.sh b/ctdb/config/ctdb-crash-cleanup.sh
index f7ccfc8b732..e1765188f8d 100755
--- a/ctdb/config/ctdb-crash-cleanup.sh
+++ b/ctdb/config/ctdb-crash-cleanup.sh
@@ -13,7 +13,7 @@
}
[ ! -f "$CTDB_PUBLIC_ADDRESSES" ] && {
- echo "No public addresses file found. Cant cleanup."
+ echo "No public addresses file found. Can't clean up."
exit 1
}
@@ -22,7 +22,16 @@ ctdb status 2>/dev/null && {
exit 0
}
-(cat /etc/{sysconfig,default}/ctdb | egrep "^CTDB_NATGW_PUBLIC_IP" | sed -e "s/.*=//" -e "s/\/.*//";cat "$CTDB_PUBLIC_ADDRESSES" | cut -d/ -f1) | while read _IP; do
+if [ -f /etc/sysconfig/ctdb ]; then
+ CTDB_CONFIG=/etc/sysconfig/ctdb
+elif [ -f /etc/default/ctdb ]; then
+ CTDB_CONFIG=/etc/default/ctdb
+else
+ echo "CTDB config not found. Can't clean up."
+ exit 1
+fi
+
+(cat $CTDB_CONFIG | egrep "^CTDB_NATGW_PUBLIC_IP" | sed -e "s/.*=//" -e "s/\/.*//";cat "$CTDB_PUBLIC_ADDRESSES" | cut -d/ -f1) | while read _IP; do
_IP_HELD=`/sbin/ip addr show | grep "inet $_IP/"`
[ -z "$_IP_HELD" ] || {
_IFACE=`echo $_IP_HELD | sed -e "s/.*\s//"`