Alex Rivera | Logout

Linux daemonize

Asked 2010-06-22T17:30:27.787
50

I am writing a Linux daemon . I found two ways to do it.

  1. Daemonize your process by calling fork() and setting sid.
  2. Running your program with &.

Which is the right way to do it?

Edit
Report

1 Answer

5

The first. The second is not daemonizing, but running on the background. Daemonized programs should be on its own session and process group, and should not have a controlling terminal.

answered 2010-06-22T17:37:14.727

Your Answer