diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2010-10-12 02:49:11 +1100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2010-10-12 02:57:53 +1100 |
commit | 842d9aab4e4c9531a3ac5c0376405339b7025b36 (patch) | |
tree | 97daeef767acffc1db1cdb262feaead7720a9abd | |
parent | 5ef29f9f25e483031299871046c9c743506825a2 (diff) | |
download | samba-842d9aab4e4c9531a3ac5c0376405339b7025b36.tar.gz samba-842d9aab4e4c9531a3ac5c0376405339b7025b36.tar.xz samba-842d9aab4e4c9531a3ac5c0376405339b7025b36.zip |
move extracting the config from config.tdb for public addresses
into its own function
(This used to be ctdb commit 2d478a39ed8303b0371112d61630660d12b7db2c)
-rwxr-xr-x | ctdb/config/events.d/00.ctdb | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb index 8ff6488e5f..1389ae4060 100755 --- a/ctdb/config/events.d/00.ctdb +++ b/ctdb/config/events.d/00.ctdb @@ -12,6 +12,24 @@ . $CTDB_BASE/functions loadconfig +update_config_from_tdb() { + # Pull optional ctdb configuration data out of config.tdb + PUBLICADDRESSESKEY='public-addresses:node#'`ctdb -t 1 xpnn|sed -e "s/.*://"` + rm -f $CTDB_VARDIR/state/public_addresses + ctdb pfetch config.tdb $PUBLICADDRESSESKEY $CTDB_VARDIR/state/public_addresses + [ "$?" = "0" ] && [ `stat --format="%s" /etc/ctdb/state/public_addresses` != "0" ] && [ ! -z "$CTDB_PUBLIC_ADDRESSES" ] && { + diff $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES >/dev/null 2>/dev/null + [ $? = "0" ] || { + echo CTDB public address configuration had been updated. + echo Extracting new configuration from database. + diff $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES + cp $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES + echo Restarting CTDB + service ctdb restart & + } + } +} + case "$1" in init) # make sure we have a blank state directory for the scripts to work with @@ -35,21 +53,7 @@ case "$1" in ;; startup) - # Pull optional ctdb configuration data out of config.tdb - PUBLICADDRESSESKEY='public-addresses:node#'`ctdb -t 1 xpnn|sed -e "s/.*://"` - rm -f $CTDB_VARDIR/state/public_addresses - ctdb pfetch config.tdb $PUBLICADDRESSESKEY $CTDB_VARDIR/state/public_addresses - [ "$?" = "0" ] && [ `stat --format="%s" /etc/ctdb/state/public_addresses` != "0" ] && [ ! -z "$CTDB_PUBLIC_ADDRESSES" ] && { - diff $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES >/dev/null 2>/dev/null - [ $? = "0" ] || { - echo CTDB public address configuration had been updated. - echo Extracting new configuration from database. - diff $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES - cp $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES - echo Restarting CTDB - service ctdb restart & - } - } + update_config_from_tdb & ;; monitor) # We should never enter swap, so SwapTotal == SwapFree. |