- 论坛徽章:
- 0
|
又遇到问题了,呵呵。脚本内容如下:
HA5-BF01#[/tmp]cat aa.pl
#!/usr/bin/perl
$vgname = "vg00";
@temp_lv_list = `vgdisplay -v $vgname|grep lvol|awk '{print \$3}'`; # 这部分执行时没有问题
print " @temp_lv_list \n";
foreach $lv_name (@temp_lv_list){
$stand_result = "Mirror copies 1";
$check_lv_mirror = `lvdisplay $lv_name | grep Mirror`;#为什么到这里就有问题了呢?
if($check_lv_mirror =~ /$stand_result/m){
print "$lv_name mirror is ok \n\n";}
else{
print "$lv_name mirror is not ok, please check your VG mirror \n";
}
}
HA5-BF01#[/tmp]
HA5-BF01#[/tmp]perl aa.pl
/dev/vg00/lvol1
/dev/vg00/lvol2
/dev/vg00/lvol3
/dev/vg00/lvol4
/dev/vg00/lvol5
/dev/vg00/lvol6
/dev/vg00/lvol7
/dev/vg00/lvol8
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol1
mirror is ok
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol2
mirror is ok
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol3
mirror is ok
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol4
mirror is ok
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol5
mirror is ok
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol6
mirror is ok
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol7
mirror is ok
sh[2]: Syntax error at line 2 : `|' is not expected.
/dev/vg00/lvol8
mirror is ok
HA5-BF01#[/tmp] |
|