Linux – save to file

  curl, debian, docker, linux, ubuntu

Welcome,

I have a problem writing curl data to a file.

while true; do curl -s --unix-socket /var/run/docker.sock "http://localhost/containers/s96/stats?stream=0" | tee -p /home/resources/s96.log 2>&1; sleep 2; done

The only problem seems to be working is that when the script starts over, everything in the file is deleted for a while and then overwritten.

I want it to work:

Download data -> overwrite data -> download data -> overwrite data ->
Download data -> overwrite data (all the time)

Unfortunately, it now works like this:

Delete data -> download data -> overwrite data -> delete data ->
download data -> overwrite data -> delete data (and so on all the
time)

The problem is that once there is data in the file and once the file weighs 0Byte.
one second is data in the file and the second second is nothing.

I need data continuously.

Source: Docker Questions

LEAVE A COMMENT