Can't load daemon at boot

Oliver Fromme olli at lurza.secnetix.de
Wed Sep 10 09:22:16 PDT 2003


andris at 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


More information about the freebsd-stable mailing list