[svlug] daemonize a bash script

Robert Hajime Lanning lanning at lanning.cc
Fri Jun 9 18:24:20 PDT 2006


<quote who="Brian J. Tarricone">

> True that there's no POSIX function that does this, but daemon(3) does
> do all that, and has been around since 4.4BSD (or so says the
> manpage).
>  I would venture to guess that most UNIX-ish OSes might have it.  At
> least you can expect Linux and (I would imagine) *BSD to have it.

> Check out setsid(8). (Not to be confused with setsid(2), though
> setsid(2) provides a more detailed explanation of what setsid(8)
> does.)
>  Not sure about OS availability.

Shows that I come from a SYSV background! :)

Both are available on my Gentoo box.

Though, daemon() is a C API, not usable from the shell.

setsid is something to play around with.  Replace nohup.

-- 
And, did Guloka think the Ulus were too ugly to save?
                                         -Centauri





More information about the svlug mailing list