Date: Tue, 25 May 2010 16:56:01 +0400 From: pluknet <pluknet@gmail.com> To: freebsd-rc@freebsd.org Subject: rc.d for iscontrol Message-ID: <AANLkTik2mnwUh68Nji-ilMIreHVBCXdxjLgI4rXI1XgS@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
A friend of mine (ufo@februality.com) mentioned there's still no rc.d script for iscontrol(8) in FreeBSD base. He pointed to an existing (and working) rc.d/iscsi (slightly modified by me) which might be integrated to head. It's still unclear how to handler for ex. iscsi+zfs setup. In the existing order iscsi requires NETWORKING, whilst zfs starts long before NETWORKING, so zfs cannot mount iscsi attached device. %%% #!/bin/sh # # $FreeBSD$ # # PROVIDE: iscsi # REQUIRE: NETWORKING # BEFORE: mountcritremote # KEYWORD: shutdown . /etc/rc.subr name="iscsi" start_cmd="iscsi_start" stop_cmd="iscsi_stop" rcvar="iscsi_enable" required_modules="iscsi_initiator:iscsi" iscsi_start() { ${iscsi_command} -c ${iscsi_config} -n ${iscsi_nickname} if [ -f ${iscsi_fstab} ]; then local _devs local _xdev _devs=`sed -e '/^#/d' < ${iscsi_fstab} | cut -f 1` for _xdev in ${_devs}; do local _i _i=10 echo "Wait for ${_xdev}" while [ ${_i} -ne 0 ]; do [ -c ${_xdev} ] && break sleep 1 _i=$((${_i}-1)) done done echo "mount -a -F ${iscsi_fstab}" mount -a -F ${iscsi_fstab} fi } iscsi_stop() { if [ -f ${iscsi_fstab} ]; then echo "umount -a -F ${iscsi_fstab}" umount -a -F ${iscsi_fstab} fi killall -HUP ${iscsi_command} } load_rc_config $name : ${iscsi_enable="NO"} : ${iscsi_command="iscontrol"} : ${iscsi_nickname="target0"} : ${iscsi_config="/etc/iscsi.conf"} : ${iscsi_fstab="/etc/iscsi.fstab"} run_rc_command "$1" %%% -- wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik2mnwUh68Nji-ilMIreHVBCXdxjLgI4rXI1XgS>