Date: Tue, 05 Jun 2007 17:31:49 +1000 From: Mikhail Goriachev <mikhailg@webanoide.org> To: gmoniey <gmoniey@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: startup / shutdown script (rc.d) Message-ID: <46651165.1040909@webanoide.org> In-Reply-To: <10963533.post@talk.nabble.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46651165.1040909>