I wrote a simple master-slave failover setup for my two servers using c, running redhat6 which using udp heartbeats to monitor one another. In my app I'm printing out some information like, heartbeat received, server is healthy and some more stuff. I want it to run in background and appending those printfs to nohup.out. So I issued below,

nohup ./appname &

nohup: ignoring input and appending output to nohup.out

App is running in background, but output is not appended to nohup.out. I thought it was buffered, so I gave sometime and killed it, but nohup.out is still empty,

Any thoughts in this?

  • This stackoverflow.com/questions/12919980/… describes a similar issue in Python. Have you tried explicitly flushing stdout?
    – greg
    May 25, 2015 at 4:45
  • Thank you @greg. Seems like I was not giving enough time, nohup.out is buffered. Will try flushing std out more often
    – ivcode
    May 25, 2015 at 4:54

1 Answer 1


As @greg pointed out, nohup.out was buffered. Setting buffer size of stdout to null solved it.

setbuf(stdout, NULL);

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.