process each instance only once
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 29 Jan 2018 15:06:25 +0000 (16:06 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 29 Jan 2018 15:06:25 +0000 (16:06 +0100)
Useful for instances with more than one disk

gnt-drbd-secondary-rebuild.sh

index 57c9fd9..0b22e63 100755 (executable)
@@ -3,7 +3,7 @@
 test -z "$1" && echo "Usage: $0 node" && exit 1
 node=$1
 
-gnt-node list-drbd --no-headers $node | grep secondary | awk '{ print $3 }' | while read instance ; do
+gnt-node list-drbd --no-headers $node | grep secondary | awk '{ print $3 }' | sort -u | while read instance ; do
        echo "## $instance";
        gnt-instance stop $instance
        gnt-instance modify -t plain $instance