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

📄 initd.debian

📁 Ubuntu公司提供免费的iSCSI Target
💻 DEBIAN
字号:
#!/bin/sh## chkconfig: - 39 35# description: Starts and stops the iSCSI target# debianized start-stop scriptPID_FILE=/var/run/iscsi_trgt.pidCONFIG_FILE=/etc/ietd.confDAEMON=/usr/sbin/ietdPATH=/sbin:/bin:/usr/sbin:/usr/binRETVAL=0ietd_start(){	echo -n "Starting iSCSI enterprise target service: "	modprobe -q crc32c	modprobe iscsi_trgt	start-stop-daemon --start --exec $DAEMON --quiet	RETVAL=$?	if [ $RETVAL -eq 0 ]; then	    echo "succeeded."	else	    echo "failed."	fi}ietd_stop(){	echo -n "Removing iSCSI enterprise target devices: "	# ugly, but ietadm does not always provide correct exit values	RETURN=`ietadm --op delete 2>&1`	RETVAL=$?	if [ $RETVAL -eq 0 ] && [ x$RETURN != x"something wrong" ]; then	    echo "succeeded."	else	    echo "failed with reason :$RETURN"	    exit 1	fi	echo -n "Stopping iSCSI enterprise target service: "	start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE	RETVAL=$?	if [ $RETVAL -eq 0 ]; then	    echo "succeeded."	else	    echo "failed."	fi	# ugly, but pid file is not removed by ietd	rm -f $PID_FILE	echo -n "Removing iSCSI enterprise target modules: "	modprobe -r iscsi_trgt	RETVAL=$?	modprobe -r crc32c 2>/dev/null	if [ $RETVAL -eq 0 ]; then	    echo "succeeded."	else	    echo "failed."	    exit 1	fi}case "$1" in  start)        ietd_start        ;;  stop)        ietd_stop        ;;  restart)        ietd_stop	sleep 1	ietd_start        ;;  status)	PID=`pidof ietd`	if [ $PID ]; then		echo "iSCSI enterprise target is running at pid $PID"	else		echo "no iSCSI enterprise target found!"		exit 1	fi        ;;  dump)	DUMP=`tempfile -p ietd`	RETVAL=$?	if [ $RETVAL -ne 0 ]; then	    echo "Failed to create dump file $DUMP"	    exit 1	fi        ietadm --mode dump --all >$DUMP	RETVAL=$?	if [ $RETVAL -ne 0 ]; then	    echo "Error dumping config from daemon"	    rm $DUMP	    exit 1	fi	mv -u $DUMP $CONFIG_FILE	echo "Config dumped to $CONFIG_FILE"        ;;  *)        echo $"Usage: $0 {start|stop|restart|status|dump}"        exit 1esacexit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -