From owner-freebsd-stable@FreeBSD.ORG Tue Sep 9 08:42:57 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 B430E16A4BF for ; Tue, 9 Sep 2003 08:42:57 -0700 (PDT) Received: from gate.multicom.lv (gate.multicom.lv [159.148.36.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D3EA43FDF for ; Tue, 9 Sep 2003 08:42:55 -0700 (PDT) (envelope-from andris@multicom.lv) Received: from gate.multicom.lv (www@localhost [127.0.0.1]) by server.multicom.lv (8.12.9/8.12.9) with SMTP id h89Fgqao011427 for ; Tue, 9 Sep 2003 18:42:53 +0300 (EEST) (envelope-from andris@multicom.lv) Received: from 159.148.112.148 (SquirrelMail authenticated user andris) by gate.multicom.lv with HTTP; Tue, 9 Sep 2003 18:42:53 +0300 (EEST) Message-ID: <3057.159.148.112.148.1063122173.squirrel@gate.multicom.lv> Date: Tue, 9 Sep 2003 18:42:53 +0300 (EEST) From: andris@multicom.lv To: freebsd-stable@freebsd.org User-Agent: SquirrelMail/1.4.1 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal Subject: Can't load daemon at boot X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Sep 2003 15:42:57 -0000 Hi! 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): #################### void shutdown(int sig) { switch (sig) { default: fprintf(stderr, "Got signal %d. Exit\n", sig); break; } exit(EXIT_SUCCESS); } int main(void) { chproc = fork(); if (chproc == -1) { perror("Unable to fork"); exit(EXIT_FAILURE); } if (chproc != 0) { fprintf(stderr, "Starting daemon...\n"); exit(EXIT_SUCCESS); } signal(SIGHUP, &shutdown); signal(SIGINT, &shutdown); signal(SIGQUIT, &shutdown); signal(SIGTERM, &shutdown); signal(SIGABRT, &shutdown); while (1) { sleep(1); } return 0; } #################### 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". Any ideas? Andris