當程式沒問題時就會吃掉輸出的 chronic

跑 cron job 的時候,希望程式有問題的時候通知管理者 (或是執行者),這個可以透過 moreutils 內的 chronic 來達成:

chronic - runs a command quietly unless it fails

chronic 會將 stdout 與 stderr 的輸出結果暫存起來,如果程式正常結束 (exit 0) 就不管他,但如果有問題的時候就會 output 出來 (exit 不是 0,或是 crash),而 cron 在收到 stdout/stderr 有東西時,會寄信給管理者或是執行者,這剛好就是我們要的行為。

算是很好用的指令,沒事你不會想管他輸出什麼啊... XD

man 的復活節彩蛋

有人在 Unix & Linux Stack Exchange 上抱怨他的自動化測試在清晨會爛掉,但其他時間都好的:「Why does man print “gimme gimme gimme” at 00:30?」。

We've noticed that some of our automatic tests fail when they run at 00:30 but work fine the rest of the day. They fail with the message "gimme gimme gimme" in stderr, which wasn't expected. Why are we getting this output?

然後兇手跟作者都自己跑來出來說明 & 修正了 XDD

該 tweet 出自:

最近 man 怎麼這麼紅啊 XDDD (像是「10 Year Old Root Exploit Found in 'man' Command」),你們這些人不要亂搞啊 XDDD 這樣很吃大家通靈的時間啊 XDDD