Correct Daemon Behaviour Posted On : Oct. 1, 2018, 4:32 p.m.

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 :

  1. Close all open file descriptors.
  2. Change current working directory.
  3. Reset the file access creation mask.
  4. Run in the background.
  5. Disassociate from process group.
  6. Ignore terminal I/O signals.
  7. Disassociate from a control terminal.
  8. Don't reacquire a control terminal.
  9. 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.

See more blog posts