diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2022-04-21 03:54:07 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2022-04-21 03:54:07 +0000 |
commit | 7885dc0ac20062d6e7bb9aa2cc1d0197fcc865e0 (patch) | |
tree | 98817a7265f9720111b2f3976ddfd33d4f19a8a5 /scripts | |
parent | 8cd2200ba1758cd127a1b95ab1808cde4f56713c (diff) | |
download | sg3_utils-7885dc0ac20062d6e7bb9aa2cc1d0197fcc865e0.tar.gz |
https://github.com/doug-gilbert/sg3_utils/pull/17 applied with tweaks: add timeout parameter
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@946 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rescan-scsi-bus.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh index 862badaa..09e22a4a 100755 --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh @@ -4,7 +4,7 @@ # (c) 2006--2022 Hannes Reinecke, GNU GPL v2 or later # $Id: rescan-scsi-bus.sh,v 1.57 2012/03/31 14:08:48 garloff Exp $ -VERSION="20220117" +VERSION="20220420" SCAN_WILD_CARD=4294967295 setcolor () @@ -272,7 +272,7 @@ testonline () RC=$? # Handle in progress of becoming ready and unit attention - while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do + while [ $RC = 2 -o $RC = 6 ] && [ $ctr -lt $timeout ] ; do if [ $RC = 2 ] && [ "$RMB" != "1" ] ; then echo -n "." let LN+=1 @@ -1128,6 +1128,7 @@ if [ "@$1" = @--help ] || [ "@$1" = @-h ] || [ "@$1" = "@-?" ] ; then echo " -m update multipath devices [default: disabled]" echo " -r enables removing of devices [default: disabled]" echo " -s look for resized disks and reload associated multipath devices, if applicable" + echo " -t SECS timeout for testing if device is online. Test is skipped if 0 [default: 30]" echo " -u look for existing disks that have been remapped" echo " -V print version date then exit" echo " -w scan for target device IDs 0--15 [default: 0--7]" @@ -1153,6 +1154,7 @@ if [ "@$1" = @--help ] || [ "@$1" = @-h ] || [ "@$1" = "@-?" ] ; then echo "--resize: same as -s" echo "--sparselun: Tell kernel to support sparse LUN numbering" echo "--sync/nosync: Issue a sync / no sync [default: sync if remove]" + echo "--timeout=SECS: same as -t" echo "--update: same as -u" echo "--version: same as -V" echo "--wide: same as -w" @@ -1213,6 +1215,7 @@ sync=1 existing_targets=1 mp_enable= lipreset=-1 +timeout=30 declare -i scan_flags=0 ignore_rev=0 @@ -1232,6 +1235,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do m) mp_enable=1 ;; r) remove=1 ;; s) resize=1; mp_enable=1 ;; + t) timeout=$2; shift ;; u) update=1 ;; w) opt_idsearch=$(seq -s ' ' 0 15) ;; -alltargets) existing_targets=;; @@ -1245,7 +1249,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do -ids=*) arg=${opt#-ids=}; opt_idsearch=$(expandlist "$arg") ; filter_ids=1;; -ignore-rev) ignore_rev=1;; -issue-lip) lipreset=0 ;; - -issue-lip-wait) lipreset=${opt#-issue-lip-wait=};; + -issue-lip-wait=*) lipreset=${opt#-issue-lip-wait=};; -largelun) scan_flags=$((scan_flags|0x200)) ;; -luns=*) arg=${opt#-luns=}; lunsearch=$(expandlist "$arg") ;; -multipath) mp_enable=1 ;; @@ -1254,6 +1258,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do -remove) remove=1 ;; -reportlun2) scan_flags=$((scan_flags|0x20000)) ;; -resize) resize=1;; + -timeout=*) timeout=${opt#-timeout=};; -sparselun) scan_flags=$((scan_flags|0x40)) ;; -sync) sync=2 ;; -update) update=1;; |