[svlug] Re: Give an environment to a daemon called by init

George Georgalis georgw at galis.org
Tue Apr 22 11:51:57 PDT 2003


On Mon, Apr 21, 2003 at 06:14:54PM -0700, Akbar Ahmed wrote:
>Hi,
>
>I have written a daemon that uses system()/fork()
>exec() in several places to call external binaries and
>scripts. 
>
>The daemon works at 100% when I logon (via ssh or a
>tty) and start the daemon via its init script. 
>
>However, all calls to system() fail when I start my
>daemon via my init script (during boot). Please note
>that all functionality within my daemon still works
>except calls to system(). The biggest problem is when
>I try to use system() to call another daemon's init
>script, such as mysqld or network. The other binary's
>init script returns success but does not actually
>start or stop the deamon.

maybe the second init script starts something like (from debian
/etc/init.d/skeleton) this but the binary is not available yet because
the partition is not yet mounted?

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/daemon
NAME=daemon
DESC="some daemon"

test -x $DAEMON || exit 0


The programs exits with no failure because there is no executable.

have the program execute env and cat /etc/mtab to some temp file both
ways and see what the difference is.

// George


-- 
GEORGE GEORGALIS, System Admin/Architect    cell: 347-451-8229 
Security Services, Web, Mail,            mailto:george at galis.org 
Multimedia, DB, DNS and Metrics.       http://www.galis.org/george 




More information about the svlug mailing list