⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iscsi_disconnect

📁 iscsi源代码 UNH的progect 有initiator端和target端的源码
💻
字号:
#!/bin/sh# This script attempts to disconnect from all connected 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 ))# Set the Host numberHOSTPATH="`ls /proc/scsi/iscsi_initiator/* | /bin/egrep -v "target|conn|stat" 2>/dev/null`"export HOST="`/bin/basename $HOSTPATH`"for ITARGET in ${UNH_ISCSI_DEV}/*do	if [ -L ${ITARGET} ] 	then		# This could be one of the links		/bin/rm ${ITARGET}		continue	fi	TARGET_NO="`/bin/basename ${ITARGET}`"	(( tcount = tcount + 1 ))	# Disconnect from target	if [ -f $HOSTPATH ] ; then		echo "Attempting to disconnect from ${ITARGET}... "		iscsi_config down host=$HOST target=${TARGET_NO}		else			echo " No iSCSI HBA found: $HOSTPATH "			(( ecount = ecount + 1 ))	fi	# The device file for the target should have gone away	if [ -d ${UNH_ISCSI_DEV}/${TARGET_NO} ]	then		(( ecount = ecount + 1 ))	else		(( 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}	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 + -