diff options
author | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2011-04-18 17:21:45 +0200 |
---|---|---|
committer | root <root@target.spline.inf.fu-berlin.de> | 2011-04-18 17:21:45 +0200 |
commit | f3805c7b00185366104a5759ab20f1ce74db688b (patch) | |
tree | 6e3fe815d4b32e5c35fb937cd61236b2dc79eb64 | |
parent | 1a6a9a86f6a037343800380e9e619047383b1d2a (diff) | |
download | iscsi-helper-f3805c7b00185366104a5759ab20f1ce74db688b.tar.gz iscsi-helper-f3805c7b00185366104a5759ab20f1ce74db688b.tar.bz2 iscsi-helper-f3805c7b00185366104a5759ab20f1ce74db688b.zip |
addIscsiDisk: handle error if executed with no arguments
-rwxr-xr-x | addIscsiDisk | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addIscsiDisk b/addIscsiDisk index 1bda195..364100b 100755 --- a/addIscsiDisk +++ b/addIscsiDisk @@ -1,11 +1,16 @@ #!/bin/bash -lvname=$(basename $1) -if [ -z "${lvname}" -o ! -b "/dev/scsiRaid/${lvname}" ]; then +if [ -z "${lvname}" ]; then echo "Usage: $0 <lvname>" exit 1 fi +lvname=$(basename $1) +if [ ! -b "/dev/scsiRaid/${lvname}" ]; then + echo "Device '/dev/scsiRaid/${lvname}' not found." + exit 1 +fi + # check if disk exists in config if grep -qs "Path=/dev/scsiRaid/${lvname},Type=diskio" /etc/iet/ietd.conf ; then echo "Disk is already in config file. Not adding it again." >&2 |