Daemonize Anything
I hacked together this little C program from this other little c program. Basically acts as an execution wrapper that lets you fork() and detach and run a command in the background with a pidfile and log file for program output. So far I havent had any problems with it… but then I’m not a true C guy so any input is welcomed.
Subscribe to the comments for this post
2 People have left comments on this post
Apr 10, 2008 - 11:04:08popen():freopen( “/path/to/logfile”, “a”, stdout);
freopen( “/path/to/logfile”, “a”, stderr);
exec[l|v]p( command, … );
Thus you can get both stdout and stderr, you don’t spawn another process and you don’t open and close the log file on every 1024 chars. Of course, the error checking was omitted
Stop by and leave a comment on my site (now: WinBreak.com) or just look me on on a messenger service:
AIM: RotatingFlavors
MSN: NuAngel@hotmail.com