Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jun 2007 00:29:48 -0700 (PDT)
From:      gmoniey <gmoniey@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: startup / shutdown script (rc.d)
Message-ID:  <11003239.post@talk.nabble.com>
In-Reply-To: <20070606224103.GA80072@gizmo.acns.msu.edu>
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> <46651165.1040909@webanoide.org> <10982826.post@talk.nabble.com> <20070606224103.GA80072@gizmo.acns.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help


Jerry McAllister-2 wrote:
> 
> Just as a test, I made the following sample script and named it   chkrc.sh
> and put it in /usr/local/etc/rc.d  with execute permission.
> It works just fine running from command line or as part of boot
> or shutdown.    You might try it as proof of concept and go from
> there.    Don't include the lines of dashes I put to deliminate it.
> Start with the #!/bin/sh line and end with the blank echo line.
> 
> 

I ran this script form the command line, and everything worked fine...so
then i tried to run it after issuing a reboot command...and this was the
output:

 Entering chkrc -- at: Wed Jun  6 23:22:19 PDT 2007
  +>> running chkrc.sh with a start argument
 Leaving chkrc -- at Wed Jun  6 23:22:19 PDT 2007

kinda wierd that the stop command wasnt issued....but i am more concerned
with the start command anyways...so i added my stuff to the file, which now
looks like this:

#!/bin/sh

echo " Entering chkrc -- at: `date` " >> /tmp/chkrc.log

case "$1" in
start)
  echo "  +>> running chkrc.sh with a start argument" >> /tmp/chkrc.log
  kldload accf_http >> /tmp/chkrc.log
  mongrel_rails cluster::start -v -C
/usr/local/www/myapp/config/mongrel_cluster.yml >> /tmp/chkrc.log
  /usr/local/www/myapp/script/backgroundrb start
  ;;
stop)
  echo "  <<- Running chkrc.sh with a stop argument" >> /tmp/chkrc.log
  mongrel_rails cluster::stop -v -C
/usr/local/www/myapp/config/mongrel_cluster.yml >> /tmp/chkrc.log
  /usr/local/www/myapp/script/backgroundrb stop
  ;;
*)
  echo "Calling args for chkrc.sh are start and stop" >> /tmp/chkrc.log
;;
esac

echo " Leaving chkrc -- at `date`" >> /tmp/chkrc.log
echo " " >> /tmp/chkrc.log


and i rebooted...but the tmp file looked the same (i.e. same output as the
example you gave me), and none of my processes were running...i also tested
this script from the command line, and both the start and stop commands work
correctly, and the results are outputted to the temp file as expected...

i dont know that much about unix, but is it possible that other variables
arent setup yet...and so my calls to mongrel_rails (which has a link in my
/usr/local/bin)?

i also changed the >> to expect STDERR, and still no luck...

-- 
View this message in context: http://www.nabble.com/startup---shutdown-script-%28rc.d%29-tf3848895.html#a11003239
Sent from the freebsd-questions mailing list archive at Nabble.com.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11003239.post>