4

Many programs allow to be run either in daemon mode (which is usually the default), or explicitly run it in foreground with a flag such as -f.

Now when configuring upstart to run programs like this, I can either do

exec foo -f # run in foreground

or

expect fork
exec foo # automatically runs as a daemon

Is there a reason to choose one over the other? It feels that it's just easier to run everything in foreground and let upstart handle the processes, but is there a downside to that?

  • The answer would depend on end-use, no? The foreground option is often provided as an easy way to debug what the daemon is doing. – pete Jun 22 '15 at 17:28
0

I strongly prefer to run things in the foreground; it avoids any complications that may arise from the daemonisation process (such as upstart losing track of the long-running daemon process). The only exception to this is a small minority of daemonising programs which have the unpleasant habit of interpreting "please run in the foreground" as "please run in some sort of poorly-performing debug mode", and do something silly like run only one thread, or don't spawn child workers, or some such.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.