iscsi_connect

来自「iscsi源代码 UNH的progect 有initiator端和target端」· 代码 · 共 58 行

TXT
58 行
字号
#!/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 + =
减小字号Ctrl + -
显示快捷键?