A Linux Daemon and the STDIN/STDOUT

前端 未结 6 1720
一生所求
一生所求 2021-02-14 23:30

I am working on a linux daemon and having some issues with the stdin/stdout. Normally because of the nature of a daemon you do not have any stdin or stdout. However, I do have a

6条回答
  •  灰色年华
    2021-02-15 00:03

    Your design is wrong. Daemon processes should not take input via stdin or deliver output to stdout/stderr. You'll close those descriptors as part of the daemonizing phase. Daemons should take configuration parameters from the command line, a config file, or both. If runtime-input is required you'll have to read a file, open a socket, etc., but the point of a daemon is that it should be able to run and do its thing without a user being present at the console.

提交回复
热议问题