[BusyBox] how to automatically start an app at boot time?

Gyepi SAM gyepi at praxis-sw.com
Tue Jan 20 16:14:06 UTC 2004


On Tue, Jan 20, 2004 at 09:09:23AM -0500, Robert P. J. Day wrote:
> so what does it mean to "daemonize" an app?  i mean, beyond some
> fairly obvious steps, is there a technical meaning to the phrase
> "daemonize" here?

Quoting and paraphrasing from Stevens' APUE

In order to daemonize, an app must:

1. (a) become the session leader of a new session, (b) become the process
group leader of a new process group and (c) not have a controlling terminal.

This basically means fork [twice, to maintain portability] and call setsid().

2. Change CWD to / so the filesystem the app is started from could be
unmounted if necessary.

3. set file creation mask to 0 so you start off from a known point.

4. close unneeded file descriptors, which may have been inherited from the
shell.


You can also use the start-stop-daemon applet and pass the 'daemonize' option ;)

-Gyepi



More information about the busybox mailing list