Wednesday, February 4, 2009

讓程序(process)在 user 登出或斷線後也能持續地跑

讓程序(process)在 user 登出或斷線後也能持續地跑
如果你把 terminal 關掉或斷線的話,在執行中的程式會被 killed,就算你用 & 把程序放 bg (background)也同樣會被 killed。

這指令 nohup ("no hangup") 是用來解決此一問題的

# nohup command &
The command will continue to run if you log out. Any output from the command is saved in a file called nohup.out

ps. 也可以用 screen 來做

The UNIX Programming Environment P.35

No comments: