I’d like to know how one would create an application that starts in the background. I’m currently creating a webserver in C as a little project, both to learn some old C and Linux Socket Programming. But my current concern is:
- How do I get the current process number?
I want to get this because when I start the process, I want to display the process number for the user who starts the service.
- My second problem is, how do I start my application as a Daemon to run in the background?
Any references, tutorials and/or videos on how I’d do this is appreciated!
Maybe I was a little bit unclear; I want to get the Process ID from within C. So, do I need to create a shell script for my application or can I do this from C?
getpid()function.