I am running the monitoring scripts in the background. They are supposed to all day (24x7).

In the script, based on the monitor output I have a function to start a process using nohup, redirecting the output to the log file /home/nohub_logs/logfile.txt.

The script works fine for few hours but after these few hours the log file is still zero bytes length. Sometimes if I kill the monitoring script and restart the script I get some output.

nohup startprocessscript.sh >> /home/nohuplog &

Logs are getting generated after some time. For example, if the script is running for the first 24 hours, then after 24 hours the logs are not getting created. If we restart the script the logs are created.

I am not sure why sometime the nohup log files are not getting any generated data. Can anyone help me, please.

closed as unclear what you're asking by Ipor Sircer, Stephen Rauch, Jeff Schaller, Satō Katsura, DarkHeart Nov 1 '17 at 1:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It seems that some logs are created and updated fine, while some are not. Can you elaborate on that? – Zip Oct 30 '17 at 13:47
  • nohup startprocessscript.sh >> /home/nohuplog & this is the command I am using logs are getting generated after some times say script is working for first 24 hours .. after 24 hours the logs are not getting created. if we restart the script the logs are created. – Hari Kris Oct 30 '17 at 14:01
  • You wrote "filled with 0 bytes", but you really mean that the output files stays empty (at size zero)? – dhag Oct 30 '17 at 15:45

A common reason for this issue is output buffering.

Your script output might be flushed to the log file only after enough data has been written.

Possible workarounds are stdbuf and unbuffer see Turn off buffering in pipe

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