Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Oct 2007 14:30:10 -0500
From:      "Jay Banks" <jay.quest4@gmail.com>
To:        <freebsd-rc@freebsd.org>
Cc:        Mike Makonnen <mtm@FreeBSD.Org>
Subject:   Re: Getting a script to run at boot
Message-ID:  <005601c8084f$526c3180$90bd050c@4BANKS>
References:  <004d01c80830$5447e770$90bd050c@4BANKS> <20071006171455.GA71986@terra.mike.lan>

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

> A few things would help diagnose this problem:
> o FreeBSD version

Basic stock install of FreeBSD 6.2

> o output with rc_debug=yes in /etc/rc.conf

Oct  6 13:24:03 12 root: /etc/rc: INFO: checkyesno: sntop_enable is set to 
YES.
Oct  6 13:24:03 12 root: /etc/rc: INFO: pid file (/var/run/sntop.pid): not 
readable.
Oct  6 13:24:03 12 root: /etc/rc: INFO: run_rc_command: evaluating echo 
"Startin
g sntop."; /usr/bin/nice -5 /usr/local/bin/sntop -d -r 30 -f 
/etc/sntoprc/sntoprc -w -e /usr/home/mysites/www/data/etb/index.html ().

> o the output of: ls -l /usr/local/etc/rc.d

-r-xr-xr-x  1 root  wheel  2086 Jun 26 10:12 apache21.sh
-rwxr-x--x  1 root  wheel   683 Aug 15 18:36 mpd4.sh
-rwxr-x--x  1 root  wheel   682 Jul 31 08:36 mpd4.sh.sample
-r-xr-xr-x  1 root  wheel  1659 Jun 26 14:13 mysql-server
-r-xr-xr-x  1 root  wheel   670 Jun 26 10:39 proftpd
-rwxr-xr-x  1 root  wheel  2130 Aug 16 12:33 radiusd.sh
-rwxr-xr-x  1 root  wheel  2130 Aug 16 12:31 rc.radiusd
-rwxr-xr-x  1 root  wheel   516 Oct  6 07:15 sntop

> o the contents of the local_startup knob
>    i.e: grep local_startup /etc/defaults/rc.conf /etc/rc.conf

/etc/defaults/rc.conf:local_startup="/usr/local/etc/rc.d 
/usr/X11R6/etc/rc.d" # startup script dirs.


> Is the above duplication a 'copy&paste' mistake or is it really in
> the script? If so, this may be your problem right here.

Not sure how it happend, but it just a copy & paste mistake. That would be 
too easy.

The script came from here:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-starting-services.html

I just changed "utility" to "sntop" and adjusted the command line 
accordingly.

>> If I change directory to /usr/local/etc/rc.d and do:
>>
>>          perl sntop.sh start
>
> why perl?

I don't know. "./sntop start" produces the same results

> This may mean that the program didn't damonize. If it didn't then 
> obviously
> it will terminate when you terminate the terminal you started it from. Do
> you get your prompt back after you run this command?

No I don't. The script specifically has a command line to run as a dameon:

-d, --daemon - daemon mode: make sntop capable of running in the back-
     ground.  note, it wont automatically fork into the background.

If I remove -d from the flags in /etc/rc.conf, the script will just display
to the terminal screen. When I put -d back in, it will run and output
the html file, refreshes when it is supposed to, and everything looks
good, but I do not get the prompt back afterwards.

When I reboot, the html output file is wiped out and contains no
data, and the process does not show up in the running processes.

What exactly does, "it wont automatically fork into the background,"
mean?



> Cheers,
> Mike.

Thanks for looking at it.

Jay Banks 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?005601c8084f$526c3180$90bd050c>