From owner-freebsd-rc@FreeBSD.ORG Sat Oct 6 21:10:42 2007 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12B3A16A420 for ; Sat, 6 Oct 2007 21:10:42 +0000 (UTC) (envelope-from mtm@FreeBSD.Org) Received: from terra.mike.lan (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2333D13C469; Sat, 6 Oct 2007 21:10:40 +0000 (UTC) (envelope-from mtm@FreeBSD.Org) Received: by terra.mike.lan (Postfix, from userid 1000) id 51A6E67991; Sun, 7 Oct 2007 00:15:06 +0300 (EAT) Date: Sun, 7 Oct 2007 00:15:06 +0300 From: Mike Makonnen To: Jay Banks Message-ID: <20071006211506.GA7075@terra.mike.lan> References: <004d01c80830$5447e770$90bd050c@4BANKS> <20071006171455.GA71986@terra.mike.lan> <005601c8084f$526c3180$90bd050c@4BANKS> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <005601c8084f$526c3180$90bd050c@4BANKS> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD/7.0-CURRENT (i386) Cc: freebsd-rc@freebsd.org Subject: Re: Getting a script to run at boot X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Oct 2007 21:10:42 -0000 --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--