Is it safe to pipe the output of several parallel processes to one file using >>?

后端 未结 9 1292
一整个雨季
一整个雨季 2020-12-25 11:20

I\'m scraping data from the web, and I have several processes of my scraper running in parallel.

I want the output of each of these processes to end up in the same f

9条回答
  •  失恋的感觉
    2020-12-25 12:12

    You'll need to ensure that you're writing whole lines in single write operations (so if you're using some form of stdio, you'll need to set it for line buffering for at least the length of the longest line that you can output.) Since the shell uses O_APPEND for the >> redirection then all your writes will then automatically append to the file with no further action on your part.

提交回复
热议问题