📄 iscsi_connect
字号:
#!/bin/sh# This script attempts to connect to configured targetsUNH_ISCSI_CONF=/opt/unh/iscsi/confUNH_ISCSI_DEV=/opt/unh/iscsi/devexport PATH=$PATH:/opt/unh/iscsi/binTARGET_ARG=$1(( tcount = 0 ))(( ecount = 0 ))if [ ! -d $UNH_ISCSI_CONF ]then exit 0fi# Set the Host numberexport HOST="`/bin/basename /proc/scsi/iscsi_initiator/* 2>/dev/null`"(( target_no = 0 ))for ITARGET in ${UNH_ISCSI_CONF}/*do [ "$ITARGET" = "fstab.iscsi" ] && continue [ ! -x $ITARGET ] && continue TARGET_ALIAS="`/bin/basename $ITARGET`" [ ! -z "$TARGET_ARG" -a "$TARGET_ARG" != "$TARGET_ALIAS" ] && continue (( tcount = tcount + 1 )) echo "Attempting to connect to ${TARGET_ALIAS}... " # Run the target file export TARGET_NO=$target_no /bin/sh $ITARGET if [ -d ${UNH_ISCSI_DEV}/${TARGET_NO} ] then (( target_no = target_no + 1 )) # Erase any old instance /bin/rm -f ${UNH_ISCSI_DEV}/${TARGET_ALIAS} 2>/dev/null # Link the device name to target alias ln -s ${UNH_ISCSI_DEV}/${TARGET_NO} ${UNH_ISCSI_DEV}/${TARGET_ALIAS} else (( ecount = ecount + 1 )) fidone# All passed[ $ecount -eq 0 ] && exit 0# All failed[ $ecount -eq $tcount ] && exit 1# Some failedexit 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -