From owner-freebsd-stable@FreeBSD.ORG Wed Sep 10 09:22:16 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 61C9216A4BF for ; Wed, 10 Sep 2003 09:22:16 -0700 (PDT) Received: from lurza.secnetix.de (lurza.secnetix.de [195.143.231.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8AB8143FF2 for ; Wed, 10 Sep 2003 09:22:14 -0700 (PDT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (ylqnun@localhost [127.0.0.1]) by lurza.secnetix.de (8.12.8p1/8.12.8) with ESMTP id h8AGMCCR091893 for ; Wed, 10 Sep 2003 18:22:12 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.12.8p1/8.12.8/Submit) id h8AGMCF0091892; Wed, 10 Sep 2003 18:22:12 +0200 (CEST) Date: Wed, 10 Sep 2003 18:22:12 +0200 (CEST) Message-Id: <200309101622.h8AGMCF0091892@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG In-Reply-To: <3057.159.148.112.148.1063122173.squirrel@gate.multicom.lv> X-Newsgroups: list.freebsd-stable User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.8-RELEASE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: Can't load daemon at boot X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: freebsd-stable@FreeBSD.ORG List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2003 16:22:16 -0000 andris@multicom.lv wrote: > I have a programm with code like this (this is example, the real code is > at > http://fresh.t-systems-sfr.com/linux/src/.warix/logserial-0.4.2.tar.gz.html): > [...] > When I load a.out from terminal it run fine. > I want this programm run at every boot so I place this command in > /etc/rc.local or /usr/local/etc/rc.d/prog.sh. > After boot it not run and in logs I see message "Got signal 1. Exit". A fork() is not sufficient to become a daemon. You also have to detach the process from the controlling terminal and other things. See Stevens APUE book for much more details. I'd recommend that you use the daemon(3) function. It does all of that for you. Please refer to the manpage. Regards Oliver -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "That's what I love about GUIs: They make simple tasks easier, and complex tasks impossible." -- John William Chambless