From owner-freebsd-questions@FreeBSD.ORG Thu Jun 11 02:09:34 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5FC5106564A for ; Thu, 11 Jun 2009 02:09:34 +0000 (UTC) (envelope-from drew@mykitchentable.net) Received: from smtp2.mc.surewest.net (qsmtp.mc.surewest.net [66.60.130.145]) by mx1.freebsd.org (Postfix) with SMTP id C15068FC12 for ; Thu, 11 Jun 2009 02:09:27 +0000 (UTC) (envelope-from drew@mykitchentable.net) Received: (qmail 15978 invoked from network); 10 Jun 2009 19:01:04 -0700 Received: by simscan 1.1.0 ppid: 15960, pid: 15961, t: 2.1833s scanners: regex: 1.1.0 attach: 1.1.0 spam: 3.1.7-deb X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on smtp2.surewest.net. X-Spam-Level: X-Spam-Status: No, score=0.0 required=10.0 tests=none autolearn=disabled version=3.1.7-deb X-Spam-CMAE-Analysis: v=1.0 c=1 a=6I5d2MoRAAAA:8 a=jDt-9pEAAAAA:8 a=By_-LkPHqZr8pRudffkA:9 a=DGVqtkygRiUVIpAJ7SwA:7 a=be-mj62sOUbwNkS220gCzYmFefgA:4 a=Sllw8v0m4fwA:10 Received: from unknown (HELO blacklamb.mykitchentable.net) (69.62.230.77) by smtp2 with SMTP; 10 Jun 2009 19:01:02 -0700 Received: from [127.0.0.1] (bigdaddy.mykitchentable.net [192.168.1.3]) by blacklamb.mykitchentable.net (Postfix) with ESMTPA id AE0DF165622; Wed, 10 Jun 2009 19:09:18 -0700 (PDT) Message-ID: <4A30674D.1040804@mykitchentable.net> Date: Wed, 10 Jun 2009 19:09:17 -0700 From: Drew Tomlinson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Paul Schmehl References: <6322EB049C37BA76C25CD076@Macintosh-2.local> In-Reply-To: <6322EB049C37BA76C25CD076@Macintosh-2.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 090610-0, 06/10/2009), Outbound message X-Antivirus-Status: Clean Cc: freebsd-questions@FreeBSD.org Subject: Re: Help With rc.d Script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jun 2009 02:09:35 -0000 Paul Schmehl wrote: > --On June 10, 2009 6:12:23 PM -0700 Drew Tomlinson > wrote: > >> I installed a software named "urchin" on my FBSD 7.2 box. >> Unfortunately, it didn't come with an rc.d script to automate startup >> and shutdown. And even more unfortunately, I can't seem to get my head >> around the concepts in "Practical rc.d scripting in BSD" >> (http://www.freebsd.org/doc/en/articles/rc-scripting/rcng-daemon.html). >> >> This is the command that starts the app: >> >> /usr/local/urchin/bin/urchinctl >> >> And here are the options: >> >> Usage: urchinctl [-v] [-h] [-e] [-s|-w] [-p port] action >> where: >> -v prints out the version of urchinctl >> -h prints out this information >> -e activates encryption (SSL) in the webserver >> -s performs the action on the Urchin scheduler ONLY >> -w performs the action on the Urchin webserver ONLY >> -p specifies the port for the webserver to listen on >> >> action is either: start, stop, restart, or status >> >> start: starts the webserver and scheduler >> stop: stops the webserver and scheduler >> restart: stops and then starts the webserver and scheduler >> status: prints out whether the webserver and scheduler are >> running >> >> By default, the action is performed on both the webserver and the >> schedulers unless the -s or -w options are specified >> >> All I want to do is create a script within the rc.d framework that runs >> "/usr/local/urchin/bin/urchinctl start" when the system boots and >> "/usr/local/urchin/bin/urchinctl stop" when the system shuts down. >> >> Following the examples in the guide mentioned above, here is my attempt >> at that file: >> >> # !/bin/sh >> # PROVIDE: urchin >> # REQUIRE: NETWORKING >> # KEYWORD: shutdown >> # >> # Add the following line to /etc/rc.conf to enable urchin: >> # urchin_enable="YES" (bool): Set to "NO" by default. >> # Set it to "YES" to enable urchin. >> . /etc/rc.subr >> name="urchin" >> rcvar=`set_rcvar` >> command="/usr/local/urchin/bin/urchinctl " >> eval "${rcvar}=\${${rcvar}:-'NO'}" >> load_rc_config $name >> run_rc_command "$1" >> >> I have also ensured that 'urchin_enable="YES"' is in /etc/rc.conf. >> However when I run the rc.d script, the urchinctl appears to run but >> doesn't like whatever arguments that are passed. See this output: >> >> urchin# ./urchin-server start >> Starting urchin. >> >> Usage: urchinctl [-v] [-h] [-e] [-s|-w] [-p port] action >> >> >> I'm sure I'm missing some simple concept. I'd really appreciate a kick >> in the right direction. >> > > Where is urchin located? /usr/local/bin? /usr/local/bin/urchin/bin? > Or somewhere else? Is urchinctl a shell or perl script? There is no actual "urchin" as far as I know. The control file is /usr/local/urchin/bin/urchinctl. It is a executable file: urchin# file /usr/local/urchin/bin/urchinctl /usr/local/urchin/bin/urchinctl: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically linked, stripped After running "/usr/local/urchin/bin/urchinctl start", I have these related processes: urchin# ps acux | grep urchin root 70937 0.0 0.0 3184 1996 ?? Ss 7:00PM 0:00.01 urchinwebd nobody 70938 0.0 0.0 3184 2000 ?? I 7:00PM 0:00.00 urchinwebd nobody 70939 0.0 0.0 3184 2000 ?? I 7:00PM 0:00.00 urchinwebd nobody 70940 0.0 0.0 3184 2000 ?? I 7:00PM 0:00.00 urchinwebd nobody 70941 0.0 0.0 3184 2000 ?? I 7:00PM 0:00.00 urchinwebd nobody 70942 0.0 0.0 3184 2000 ?? I 7:00PM 0:00.00 urchinwebd nobody 70944 0.0 0.0 1460 720 ?? Ss 7:00PM 0:00.03 urchind nobody 70946 0.0 0.0 1332 668 ?? Is 7:00PM 0:00.51 urchind And conversely, "/usr/local/urchin/bin/urchinctl stop" removes all of the above processes. Thanks, Drew -- Be a Great Magician! Visit The Alchemist's Warehouse http://www.alchemistswarehouse.com