From owner-freebsd-rc@FreeBSD.ORG Tue May 25 13:22:12 2010 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B7E71065672 for ; Tue, 25 May 2010 13:22:12 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id F00BF8FC15 for ; Tue, 25 May 2010 13:22:11 +0000 (UTC) Received: by gwj18 with SMTP id 18so1524778gwj.13 for ; Tue, 25 May 2010 06:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=uSSBbf6uLmj0n2s9DG/6aPaNg1d6T5tWRG+soKKJ3Jo=; b=pXRWRAqog/zc0fZMMEScm3XoP/xnBIAz4IAQtIolhTWAb99n2OrqR7MEKCpETg6Rq7 TZYLbkDa/phMqyW8mz8H3SHtZlsFhguEhvf+AUikCpnl9snUZ8+CGli8IPGNWPqDyF2e 7F/j2HTRXO5n2LLv+3SJA6Gp1W9tuG04dLjAc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=U0q5sApS3wU4snlaplmhsOu7Hx8vZkQ8JYa0nSQtTy0LFEF8r97+DVYIHl7ePnvZtw 4KbGfzP/AM1o9LCQ2ChUW7oYGDPQXLV4wIUaw8cseNCMp2reJyKSEr7iKhBrmheNazaG W0sb/PxIIi9Hw0GWW2gA8RX+mcqH/2g8afBR0= MIME-Version: 1.0 Received: by 10.101.129.10 with SMTP id g10mr8034258ann.31.1274792162011; Tue, 25 May 2010 05:56:02 -0700 (PDT) Received: by 10.100.208.9 with HTTP; Tue, 25 May 2010 05:56:01 -0700 (PDT) Date: Tue, 25 May 2010 16:56:01 +0400 Message-ID: From: pluknet To: freebsd-rc@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: rc.d for iscontrol X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 May 2010 13:22:12 -0000 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