在用 terminal 或是 putty 登入 server 之後,跑一個很花時間,又不需要一直看著的程式(例如 emerge)
想回家時,又不能 logout,因為一但 logout 該程式就會被中斷。
如果有這個需求,就請用 nohup 吧
-------------------------
`nohup' runs the given COMMAND with hangup signals ignored, so that the
command can continue running in the background after you log out.
-------------------------
command can continue running in the background after you log out.
-------------------------
舉個例子,如果希望 logout 後,再進來看 emerge 執行結果,
可以像這樣下指令:
nohup emerge -uD world &
如此會把 output 都寫到 nohup.out
下次登入就看 nohup.out
另外,想要一邊看結果,一邊等,時間晚了就關機回家,就再加以下指令
tail -f nohup.out
tail 有沒有加 -f 有差喔!沒有加的話,就只是顯示完就結束了。而加了 -f ,會持續看檔案有無更新,有的話馬上顯示出來,看 log 最方便的東西了。
參考:
info nohup
man tail
全站熱搜
留言列表