Hello all!

I am in need to run on linux a small app that calls other apps and leaves them
running in background. What's so special about this ? It is suitable for
performing this kind of operation from php3 scripts.
My problem is that this was conceived to work on bsd systems and I have heard
that bsd signals stuff in linux should be taken into consideration, in order to
make it work properly on linux. This doesn't perform ok on linux without
modifications which I am not qualified to perform.
It compiles ok, but, when I run it, the called app doesn't stay on the
background.

Here's the code :

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
int pid;

  pid=fork();

  if (pid!=0)
  {
    pid=setsid();
    close(STDOUT_FILENO);
    close(STDIN_FILENO);
    close(STDERR_FILENO);
    execl(argv[1],argv[2],0);
  }

  return 0;
}

Any help would be appreciated.

Thanks

Joao
                                          ^\   /^
                                            O O
----------------------------------------o00-(_)-00o--------------------------
Sent on 15-Dec-99 at 00:39:40
Powered by FreeBSD -> http://www.freebsd.org <-  "The Power to Serve"
More info @ http://www.freebsddiary.org/freebsd/ - http://www.daemonnews.org/
-----------------------------------------------------------------------------
PGP key available upon request or may be cut at 
http://pedras.webvolution.net/pgpkey.html
-----------------------------------------------------------------------------
Noncombatant, n.:
        A dead Quaker.
                -- Ambrose Bierce

Reply via email to