Create child under different uid and capture stdin and stdout

I am fairly new to process management in Linux however quite familiar with it in Windows.

My goal is to create a daemon that will start a game server (such as Valve's srcds) under a different uid and capture both the input and output. If it stops, I'd like it to be able to reattach to the process.

I have several questions on this.

1. What is the best way to start the game server process?
Should it be a child process? Will that cause an issue if one segfaults?
2. Is it possible to reattach to the process?
3. Does the daemon need to run as root, or can I set up special permissions for the daemon user to have power over another user account?
4. Is it possible to receive events when the process stops? Or do I need to actively monitor the pid?

Thanks.
You should get yourself a copy of "Advanced Programming in the Unix Environment" and read it. What you are asking will require lots of reading to get right. Or you could use http://bmc.github.com/daemonize/

You'll need to actively monitor the process if it has a habit of crashing.
Topic archived. No new replies allowed.