From owner-freebsd-questions@FreeBSD.ORG Thu Jun 11 01:51:37 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 73D961065676 for ; Thu, 11 Jun 2009 01:51:37 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 34EEF8FC29 for ; Thu, 11 Jun 2009 01:51:36 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 283D07E83F; Wed, 10 Jun 2009 17:51:36 -0800 (AKDT) From: Mel Flynn To: freebsd-questions@freebsd.org Date: Wed, 10 Jun 2009 17:51:35 -0800 User-Agent: KMail/1.11.3 (FreeBSD/8.0-CURRENT; KDE/4.2.3; i386; ; ) References: <4A3059F7.8080301@mykitchentable.net> In-Reply-To: <4A3059F7.8080301@mykitchentable.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906101751.35272.mel.flynn+fbsd.questions@mailing.thruhere.net> Cc: Drew Tomlinson 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 01:51:38 -0000 On Wednesday 10 June 2009 17:12:23 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 " ${name}_args=$1 : ${name}_enable="NO" > load_rc_config $name > run_rc_command "$1" I think the above would work, but didn't test it. -- Mel