From owner-freebsd-questions@FreeBSD.ORG Sat Nov 13 16:58:04 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D73116A4CE for ; Sat, 13 Nov 2004 16:58:04 +0000 (GMT) Received: from mail.seekingfire.com (coyote.seekingfire.com [24.72.10.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0190C43D41 for ; Sat, 13 Nov 2004 16:58:04 +0000 (GMT) (envelope-from tillman@seekingfire.com) Received: by mail.seekingfire.com (Postfix, from userid 500) id A215C56C; Sat, 13 Nov 2004 10:58:00 -0600 (CST) Date: Sat, 13 Nov 2004 10:58:00 -0600 From: Tillman Hodgson To: FreeBSD-Questions Message-ID: <20041113165800.GD33689@seekingfire.com> References: <20041113040749.GB33689@seekingfire.com> <20041113052818.GE37496@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041113052818.GE37496@dan.emsphone.com> X-Habeas-SWE-1: winter into spring X-Habeas-SWE-2: brightly anticipated X-Habeas-SWE-3: like Habeas SWE (tm) X-Habeas-SWE-4: Copyright 2002 Habeas (tm) X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this X-Habeas-SWE-6: email in exchange for a license for this Habeas X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this X-Habeas-SWE-9: mark in spam to . X-GPG-Key-ID: 828AFC7B X-GPG-Fingerprint: 5584 14BA C9EB 1524 0E68 F543 0F0A 7FBC 828A FC7B X-GPG-Key: http://www.seekingfire.com/personal/gpg_key.asc X-Urban-Legend: There is lots of hidden information in headers X-Tillman-rules: yes he does User-Agent: Mutt/1.5.6i Subject: Re: Setting SCSI bus options before reaching fsck at boot time X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Nov 2004 16:58:04 -0000 On Fri, Nov 12, 2004 at 11:28:18PM -0600, Dan Nelson wrote: > In the last episode (Nov 12), Tillman Hodgson said: > > I'd like to find a way to have camcontrol (or some other mechanism) > > set the SCSI bus speed on this particular SCSI chain early in the > > boot process, /before/ it encounters fsck and thus trips over it's > > own feet in bus resets. > > Since camcontrol is in /sbin, you can just add a line to the top of > /etc/rc. A cleaner solution would be to write a small /etc/rc.d/ > script and add a "BEFORE: fsck" line so it gets run before fsck. That seemed like a reasonable approach, so I took a stab at it. Unfortunately, I haven't worked with custom RCng scripts before and I can't seem to get the script to run. Here's what I have (blank lines removed to save some space): #!/bin/sh # # PROVIDE: camcontrol_start # REQUIRE: disks # BEFORE: bgfsck . /etc/rc.subr name="camcontrol_tillman" rcvar=`set rcvar` start_cmd="camcontrol_start" stop_cmd=":" camcontrol_start() { echo -n "camcontrol_tillman has started " echo -n "da0 " camcontrol negotiate da0 -R10 -a -q ... (repeated for da1 through da6 (it's a 7 bay JBOD tower)) ... info "camcontrol_tillman has finished" } load_rc_config $name run_rc_command "$1" I also have the following in /etc/rc.conf: ### Tillmans custom RCng scripts camcontrol_tillman_enable="YES" When I run the following by hand, it works: root@thoth# camcontrol negotiate da6 | grep freq (pass6:sym1:0:6:0): frequency: 20.000MHz root@thoth# camcontrol negotiate da6 -R10 -q -a root@thoth# camcontrol negotiate da6 | grep freq (pass6:sym1:0:6:0): frequency: 10.000MHz Yet when I run `/etc/rc.d/camcontrol_tillman start` (or even forcestart), all I get is: root@thoth# /etc/rc.d/camcontrol_tillman forcestart # camcontrol_tillman Aside from the echo statements not outputting anything, a quick check confirms that it really didn't do anything: root@thoth# camcontrol neg da5 | grep freq (pass5:sym1:0:5:0): frequency: 20.000MHz I'm assuming that I just don't understand something relatively simple about the RCng system and that the script is missing something relatively minor. Anyone care to enlighten me? -T -- "The important thing is not to stop questioning. Curiosity has its own reason for existing." -- Albert Einstein