startup / shutdown script (rc.d)

Jerry McAllister jerrymc at msu.edu
Wed Jun 6 22:45:46 UTC 2007


On Tue, Jun 05, 2007 at 11:00:07PM -0700, gmoniey wrote:

>
> as my luck would have it...this didn't work...i used your script...test it by
> running ./rtest start & ./rtest stop and everything worked fine (note: i
> changed the name from rails to rtest as rails is an actual command)...
>
> but when i rebooted nothing happened. I had the output dump to file and the
> file was empty upon restart, which makes me believe it never actually ran..

You didn't even see the output from the echo command?
Try sticking one in before the case statement so it would always run
regardless of start or stop.

>
> Side Note: Jerry, the mongrel_rails command does spew some output, which is
> why i dump it to file...

OK.   But do you know whether it writes that output to STDOUT
or maybe to STDERR.    If it is STDERR you will need a little
different syntax than  '>>'  Something like   '2>&1 >' filename

> i even added the line rtest_enable="YES" in my /etc/rc.conf file and
> rebooted, but still no luck....
>
> thanks for your help fellas...i'll keep reading up as you suggested...
>

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.

////jerry


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
#!/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 
  ;;
stop) 
  echo "  <<- Running chkrc.sh with a stop argument" >> /tmp/chkrc.log 
  ;;
*)  
  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
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  


> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list