-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrescan.pl
More file actions
executable file
·41 lines (36 loc) · 1.72 KB
/
rescan.pl
File metadata and controls
executable file
·41 lines (36 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl
###############################################################################
# #
# This script scan for Fiber LUNs without restarting Linux #
# The input parameters are : None #
# #
# Author : Avi Liani #
# Created Date : 30.10.2012 #
# Version : 1.0 1 #
# #
# Change Log : #
# #
# Date Name Change #
# ========== =============== ============================================ #
# 30.10.2012 Avi Liani Initial version #
# 10.01.2013 Avi Liani run the scan twice #
# #
###############################################################################
sub Rescan() {
opendir(NS, "/sys/class/scsi_host");
@ns=readdir(NS);
closedir(NS);
shift @ns;
shift @ns;
foreach $ns(@ns) {
open(DAT,">/sys/class/scsi_host/$ns/scan") || die("Cannot Open File");
print DAT "- - -";
close(DAT);
sleep 1 ;
}
}
for (1..2) { Rescan() ; sleep 5 ; }
my $res = `multipath -r | grep size | wc -l` ;
chomp $res ;
print $res ;
exit $res ;