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

后端 未结 9 1362
一整个雨季
一整个雨季 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:14

    Generally, no.

    On Linux this might be possible, as long as two conditions are met: each line is written in a one operation, and the line is no longer than PIPE_SIZE (usually the same as PAGE_SIZE, usually 4096). But... I wouldn't count on that; this behaviour might change.

    It is better to use some kind of real logging mechanism, like syslog.

提交回复
热议问题