[svlug] Give an environment to a daemon called by init
Robert Hajime Lanning
lanning at lanning.cc
Mon Apr 21 19:31:49 PDT 2003
On Mon, 21 Apr 2003, Rick Schultz wrote:
> On Mon, Apr 21, 2003 at 06:14:54PM -0700, Akbar Ahmed wrote:
> > However, all calls to system() fail when I start my
> > daemon via my init script (during boot).
> Fail how? (What's the error?)
> Could this problem be PATH-related?
I would look at both "PATH" and "SHELL".
Remember, the system() function does a fork() and an exec() of
the shell, to run the commend, and waitpid()'s for it to finish.
The other thing is to see if STDIN/STDOUT/STDERR are pointing
somewhere. I don't know if this would effect anything here, but
I had found that glob() in perl fails if file descriptors 0,1 and
2 are closed. I had to open /dev/null and dup()ing it after
daemonizing, to get it to work.
END OF LINE
More information about the svlug