On 15 May 2013 08:20, Thomas Thrainer <[email protected]> wrote: > The master IP setup script now checks if the master IP is actually > configured on the machine before trying to remove the IP. > > This fixes issue 460. > > Signed-off-by: Thomas Thrainer <[email protected]> > --- > tools/master-ip-setup | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/master-ip-setup b/tools/master-ip-setup > index bad47d1..1be9fc4 100755 > --- a/tools/master-ip-setup > +++ b/tools/master-ip-setup > @@ -62,6 +62,12 @@ start() { > > # Stop the master IP > stop() { > + if ! ip addr show dev $MASTER_NETDEV | \ > + grep "$MASTER_IP/$MASTER_NETMASK" >/dev/null 2>&1; then
I think you want to use the "-F" option of grep, as the address contains dots. And you should anchor at least the beginning of the expression, either by using a space or through regular expressions (but then you need to escape the address). > + echo "Master IP address not configured on this machine. Doing nothing." > + exit 0 > + fi > + > if ! ip addr del $MASTER_IP/$MASTER_NETMASK dev $MASTER_NETDEV; then > echo "Error during the deactivation of the master IP address" >&2 > exit 1 Rest LGTM, thanks. Bernardo
