Date: Sun, 7 Oct 2007 00:15:06 +0300 From: Mike Makonnen <mtm@FreeBSD.Org> To: Jay Banks <jay.quest4@gmail.com> Cc: freebsd-rc@freebsd.org Subject: Re: Getting a script to run at boot Message-ID: <20071006211506.GA7075@terra.mike.lan> In-Reply-To: <005601c8084f$526c3180$90bd050c@4BANKS> References: <004d01c80830$5447e770$90bd050c@4BANKS> <20071006171455.GA71986@terra.mike.lan> <005601c8084f$526c3180$90bd050c@4BANKS>
next in thread | previous in thread | raw e-mail | index | archive | help
--5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Oct 06, 2007 at 02:30:10PM -0500, Jay Banks wrote: > > > >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? Well, that's the problem then. The '--daemon' switch is misleading. You should get it to work as expected by adding a '&' at the end of the command-line. Just for kicks I installed it on my system and with the attached script and the following in my /etc/rc.conf it seems to work as expected (though I haven't tried running it on startup): sntop_enable=yes sntop_flags="-d -r 30 -f /usr/local/etc/sntoprc -w -e /home/mtm/public_html/sntop.html" sntop_nice=5 Cheers. -- Mike Makonnen | GPG-KEY: http://people.freebsd.org/~mtm/mtm.asc mmakonnen @ gmail.com | AC7B 5672 2D11 F4D0 EBF8 5279 5359 2B82 7CD4 1F55 mtm @ FreeBSD.Org | FreeBSD - http://www.freebsd.org --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=sntop #!/bin/sh # # PROVIDE: sntop # REQUIRE: DAEMON # KEYWORD: shutdown # # DO NOT CHANGE THESE DEFAULT VALUES HERE # SET THEM IN THE /etc/rc.conf FILE # sntop_enable=${sntop_enable-"NO"} sntop_flags=${sntop_flags-""} . /etc/rc.subr name="sntop" rcvar=`set_rcvar` command="/usr/local/bin/${name}" command_args="&" load_rc_config $name run_rc_command "$1" --5vNYLRcllDrimb99--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071006211506.GA7075>