From owner-freebsd-questions@FreeBSD.ORG Tue Jun 5 07:31:57 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86FC016A41F for ; Tue, 5 Jun 2007 07:31:57 +0000 (UTC) (envelope-from mikhailg@webanoide.org) Received: from shanshito.webanoide.org (shanshito.webanoide.org [150.101.108.110]) by mx1.freebsd.org (Postfix) with ESMTP id 9A73613C45A for ; Tue, 5 Jun 2007 07:31:56 +0000 (UTC) (envelope-from mikhailg@webanoide.org) Received: from maxito.hba.navalradio.cl (maxito.hba.navalradio.cl [172.26.4.34]) (authenticated bits=0) by shanshito.webanoide.org (8.13.8/8.13.8) with ESMTP id l557Voa8002807 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 5 Jun 2007 07:31:54 GMT (envelope-from mikhailg@webanoide.org) Message-ID: <46651165.1040909@webanoide.org> Date: Tue, 05 Jun 2007 17:31:49 +1000 From: Mikhail Goriachev Organization: Webanoide User-Agent: Thunderbird 2.0.0.0 (Macintosh/20070326) MIME-Version: 1.0 To: gmoniey References: <10902043.post@talk.nabble.com> <20070601131230.380039e8@localhost> <10906324.post@talk.nabble.com> <20070601154223.GC43330@gizmo.acns.msu.edu> <10953687.post@talk.nabble.com> <20070605031224.188cacc8@gumby.homeunix.com.> <20070605022154.GB71220@gizmo.acns.msu.edu> <10963533.post@talk.nabble.com> In-Reply-To: <10963533.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: startup / shutdown script (rc.d) 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: Tue, 05 Jun 2007 07:31:57 -0000 gmoniey wrote: > thanks for the ideas, i tried both of your suggestions...i manually ran the > rails.sh file, and everything worked as expected...so i dumped the output to > file...my .sh file looks as such: [ trim ] > the weird part is that the Rails found stop never printed...and im not sure > why the mongrel_rails fails (im assuming that the kldload works fine as it > doesn't print out any error messages if it is successfull) > > i guess i will just keep playing with it... Let's try a different approach. The following is a working script of your rails: --------------------------- #!/bin/sh # PROVIDE: rails # KEYWORD: nojail shutdown . /etc/rc.subr name="rails" start_cmd="${name} start" stop_cmd="${name} stop" rails() { case ${rc_arg} in start) echo -n "Starting ${name}: " echo -n "1 " echo -n "2 " echo "3" ;; stop) echo -n "Stopping ${name}: " echo -n "3 " echo -n "2 " echo "1" ;; *) echo "dddzzzzz" esac } load_rc_config ${name} run_rc_command "${1}" --------------------------- It looks different, but this is the new way how the OS fires things up. Place this script as "/usr/local/etc/rc.d/rails". Don't add the extension to it (.sh). The use of extensions is old school. Chmod it to 555 (or 755). Now give it a spin: # /usr/local/etc/rc.d/rails start # /usr/local/etc/rc.d/rails stop # /usr/local/etc/rc.d/rails restart # /usr/local/etc/rc.d/rails blah See what happens and then boot your machine. You'll see how it starts and stops. Once you're satisfied, tweak it to your needs. If you want to control all aspects of the thing then you should read: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-starting-services.html Also read the rc.d(8) and all of its rc.* related man pages. You can get lots of good examples in "/etc/rc.d/". For instance "/etc/rc.d/usbd" is the simplest of them all. Let us know how it goes. Regards, Mikhail. -- Mikhail Goriachev Webanoide Telephone: +61 (0)3 62252501 Mobile Phone: +61 (0)4 38255158 E-Mail: mikhailg@webanoide.org Web: www.webanoide.org