I have a script that I'm using to capture some status of the server at 10 second intervals.

The script is as follows:

for (( ; ; ))
    /usr/local/apache/bin/apachectl fullstatus
    sleep 10

And I am running the script using:

nohup /path/to/scriptname.sh | gzip > logfile.log.gz &

It will run in the background and keep running if I disconnect from ssh. However, after about 3-4 hours the output stops getting transferred to the logfile. The script is still running and shows up if I run ps -elf | grep scriptname, but the logfile does not update. Why does the output stop sending? Is this possibly a problem with the buffer?


The gzip file format has an 8-byte footer containing a CRC-32 checksum and uncompressed length of the data. The DEFLATE file format is block-oriented. The gzip program in the pipeline is almost certainly buffering up input to use in the next output block. The 8-byte footer won't be written until after the long-running shell script exits, and gzip's stdin closes. I think you'll have to wait for a long while to see if DEFLATE blocks aren't periodically written to the log file.

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.