How can I daemonize a process to work in background after main process exits ( in a POSIX OS ) . I want to make a program to start a background process and ends itself as soon as fork process starts working ( without breaking forked process ) then It terminal should go to next line and forked process must be running at background. How can I do this in C ?
Asked
Active
Viewed 156 times
0
-
read about the exec() family of functions: http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/exec.htm – Scotty Bauer Sep 30 '13 at 17:21
-
You don't need to do it in C - you can run a background process in the terminal - see http://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-a-process-in-background-623045/ – Gigi Sep 30 '13 at 17:22
-
possible duplicate of [Linux daemonize](http://stackoverflow.com/questions/3095566/linux-daemonize) – Adam Rosenfield Sep 30 '13 at 17:40
-
Shall the background process code be in a separate executable or be part of the main executable? – Armali Sep 19 '14 at 08:33