From owner-freebsd-questions@freebsd.org Wed Sep 9 13:02:48 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11383A01F0A for ; Wed, 9 Sep 2015 13:02:48 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id E9DFF1BC0 for ; Wed, 9 Sep 2015 13:02:47 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: by mailman.ysv.freebsd.org (Postfix) id E6FD9A01F09; Wed, 9 Sep 2015 13:02:47 +0000 (UTC) Delivered-To: questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCCC9A01F08 for ; Wed, 9 Sep 2015 13:02:47 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57CE41BBF for ; Wed, 9 Sep 2015 13:02:46 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-125-111.dynamic.qsc.de [92.195.125.111]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 7C887278AC; Wed, 9 Sep 2015 15:02:44 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id t89D2hBR003044; Wed, 9 Sep 2015 15:02:43 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Wed, 9 Sep 2015 15:02:43 +0200 From: Polytropon To: Olivier Nicole Cc: questions@freebsd.org Subject: Re: One daemon not starting in /etc/rc.local Message-Id: <20150909150243.e6553ca5.freebsd@edvax.de> In-Reply-To: References: <20150909134348.0668c422.freebsd@edvax.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 13:02:48 -0000 On Wed, 09 Sep 2015 18:54:52 +0700, Olivier Nicole wrote: > Polytropon writes: > > > On Wed, 09 Sep 2015 14:19:57 +0700, Olivier Nicole wrote: > >> In /etc/rc.local I have: > >> > >> # REQUIRE: networking DAEMON FILESYSTEMS devfs > >> # PROVIDE: p0f recover-backup count-stats > > > > Does rc.local pay attention to this kind of comments? > > It was my impression that both rc.local and rc.shutdown.local > > are "dumb" and determined by execution time... > > > > I tend to associate the REQUIRE and PROVIDE keywords > > with the rc ordering mechanism which rc.d/ style files > > use so they can be run the correct order. As I mentioned, > > rc.local's runtime is determined by /etc/rc itself. > > That was a try before I added the echo iii lines. I wanted to see where > in the startup sequece /etc/rc.local was called and kind of make sure it > was after the network interfaces had been started. If I remember correctly, this file will be executed via /etc/rc.d/local, depending on the (default) keywords found in _that_ file, but only if /etc/rc.local actually does exist. > >> echo iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii > >> > >> # start the OS fingerprint analyzer > >> # -l means on line per record! > >> /usr/local/bin/p0f -i vmx0 'tcp dst port 25' 2>&1|/usr/local/bin/p0f-analyzer.pl 2345 & > >> > >> echo iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii > >> > >> > >> At boot I see the 2 lines of iii but p0f is not started. > >> > >> If I copy/paste in sheel the line /usr/local/bin/p0f etc. it starts, > >> prints the start-up message and runs happilly. > > > > Is the "non-use" of spaces in the segment "2>&1|/usr/local/bin/p0f" > > significant? Is the shell where you're interactively executing the > > command different from the shell that runs rc.local (/bin/sh)? > > I switched down to sh for the manual test. Okay, then the only difference could be environmental variables not set at the earlier stage (or inherited from the interactive session). The C shell of course would complaim about 2>&1. :-) > >> There must be a trivial error, but I can't see it, so any help will be > >> greatly appreciated. > > > > Except what might be pure form, I don't see any errors, so the > > reason for the different behaviour might be in the environment... > > A wild guess is that it has something to do with the fact that p0f > writes to stdout and stdout is piped to stdin of the next process. Yes, that is possible - in the context of subshells executing further commands with redirection; foreground vs. background vs. daemonized... > I noticed that in the startup script provided in amavis port, the > command is started via /usr/bin/daemon, so purposedly detaching the > control terminal. Exactly that was my thought. Things like nohup, daemon or detach can lead to interesting results when redirection is added. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...