On 28/10/2010, at 2:00 AM, Erick Tryzelaar wrote: > > http://www.unixguide.net/unix/programming/1.7.shtml
Thanks! Well this works: #include <stdio.h> #include <unistd.h> #include <stdlib.h> int main() { int child; printf("Running\n"); if ((child=fork()) != 0) { printf("Forked %d\n",child); exit(0); } setsid(); if ((child=fork()) != 0) { exit(0); } close(0); close(1); close(2); while(1){ FILE *f= fopen("log.log","w"); fprintf(f,"Daemon running\n"); fclose(f); sleep(5); } } I guess I use open() then dup2() to create fd's for 0,1,2 so the webserver can still do I/O.. not sure what happens to C++ streams cin, cout, cerr or C streams stdin, stdout. stderr though (I presume they will just keep working since underneath they have to use the unix fds ..?) -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language