
?今天的主角:nohup(no hang up)
base:
简单的后台运行:
nohup command &
就可以了。
添加日志:
nohup command > file 2>&1 &
首先我们要知道0、1、2是三个固定的fileno。
0 – stdin (standard input)
1 – stdout (standard output)
2 – stderr (standard error)
首先这里把command的输出重定向到file,再把标准错误重定向到标准输出,这样标准输出和标准错误都重定向到了file中了。