I wrote a RPC server foo in Python that I deamonized with
start-stop-daemon --start --quiet --background \
--make-pidfile \
--pidfile /var/run/foo.pid \
-- /opt/foo
Everything works fine except that every use of subprocess.check_call(some_cmd) or os.popen(some_cmd).read(1048576) in my daemon returns an empty string compared to the case when I start foo in the foreground.
The external program some_cmd is still executed sucessfully (as I can see in the logs), yet I don't have access to the stuff it prints to stdout.
Why is that and what changes can I make to either the start-stop-daemon call or my Python code in ordert to fix this?
PS: I found that only the output of certain commands is now empty: subprocess.check_output('echo "Hello World"', shell=True) still behaves normally, whereas the output of subprocess.check_output('/etc/init.d/apache2 --nocolor reload', shell=True) is now empty.
I solved it myself. The problem was that
start-stop-daemonis setting the environment variableEINFO_QUIETwhen run with the--quiteflag (not documented in the man pages...).OpenRC init scripts then prints nothing to stdout when this variable is set. A simple
solves the problem.