read instance and disk from stdin with -
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 23 Dec 2016 17:50:37 +0000 (18:50 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 23 Dec 2016 17:50:37 +0000 (18:50 +0100)
gnt-lv-snap-rsync.sh

index 2f0b06b..dbc1684 100755 (executable)
@@ -3,12 +3,16 @@
 instance=$1
 disk=$2
 
-if [ -z "$instance" -o -z "$disk" ] ; then
+if [ "$1" = '-' ] ; then
+       read instance disk
+elif [ -z "$instance" -o -z "$disk" ] ; then
        echo "Usage: $0 instance disk"
        exit 1
 fi
 
-instance=`gnt-instance list --no-headers -o name $instance`
+test -z "$instance" && exit 1
+
+instance=`gnt-instance list --no-headers -o name $instance | head -1`
 
 node=`gnt-instance list -o pnode --no-headers $instance`
 echo "# $instance on $node"