stdout redirection應用問題 - Linux
By Erin
at 2021-12-22T20:51
at 2021-12-22T20:51
Table of Contents
我寫了一支長時間運行的程式,在運行過程中會持續產生訊息至stdout,我不想太
頻繁的讀寫儲存空間,所以我目前以
$my_app > /dev/shm/my_app.log
的方式運行程式,將訊息輸出到記憶體構成的檔案系統中,當想要看即時訊息時以
$tail -f /dev/shm/my_app.log
的方式將輸出訊息顯示到終端,目前運行的還不錯,但考慮到如果程式持續運行超過
一個月,我的/dev/shm/可能會不夠,請問有沒有什麼方法讓my_app.log在超過指定
行數的時候,清除最頂端開始的n行呢?
謝謝。
--
頻繁的讀寫儲存空間,所以我目前以
$my_app > /dev/shm/my_app.log
的方式運行程式,將訊息輸出到記憶體構成的檔案系統中,當想要看即時訊息時以
$tail -f /dev/shm/my_app.log
的方式將輸出訊息顯示到終端,目前運行的還不錯,但考慮到如果程式持續運行超過
一個月,我的/dev/shm/可能會不夠,請問有沒有什麼方法讓my_app.log在超過指定
行數的時候,清除最頂端開始的n行呢?
謝謝。
--
Tags:
Linux
All Comments
By Jack
at 2021-12-23T01:18
at 2021-12-23T01:18
By Emily
at 2021-12-23T05:46
at 2021-12-23T05:46
By Vanessa
at 2021-12-23T10:13
at 2021-12-23T10:13
By Donna
at 2021-12-23T14:40
at 2021-12-23T14:40
By Steve
at 2021-12-23T19:08
at 2021-12-23T19:08
By Quanna
at 2021-12-23T23:35
at 2021-12-23T23:35
By Anthony
at 2021-12-24T04:03
at 2021-12-24T04:03
By Ula
at 2021-12-24T08:30
at 2021-12-24T08:30
By Audriana
at 2021-12-24T12:57
at 2021-12-24T12:57
By Oscar
at 2021-12-24T17:25
at 2021-12-24T17:25
By Ina
at 2021-12-24T21:52
at 2021-12-24T21:52
By Robert
at 2021-12-25T02:19
at 2021-12-25T02:19
By Edwina
at 2021-12-25T06:47
at 2021-12-25T06:47
By Oliver
at 2021-12-25T11:14
at 2021-12-25T11:14
Related Posts
read cmd 超乎預期求原因
By Dorothy
at 2021-12-22T12:08
at 2021-12-22T12:08
安裝dhcp
By Dora
at 2021-12-21T10:12
at 2021-12-21T10:12
LDAP SSSD Client 問題
By Faithe
at 2021-12-17T15:39
at 2021-12-17T15:39
Redhat7.2 usb碟無法讀取
By Anonymous
at 2021-12-10T09:39
at 2021-12-10T09:39
Ubuntu21.10哪個輸入法能自訂碼表?
By Kumar
at 2021-12-01T21:51
at 2021-12-01T21:51