Turning your process into a daemon is okay, but keeping the standards makes it formidable. According to this guide, a well behaved daemon should do the following things :
- Close all open file descriptors.
- Change current working directory.
- Reset the file access creation mask.
- Run in the background.
- Disassociate from process group.
- Ignore terminal I/O signals.
- Disassociate from a control terminal.
- Don't reacquire a control terminal.
- Correctly handle the following circumstances :
- Started by system V init process.
- Daemon termination by SIGTERM signal.
- Children generate SIGCLD signal.
Implementation and Description for IMOPAH process groups.