Skip to content

Commit 0775c0d

Browse files
authored
doc: Update nohup.md (#621)
1 parent b8b9389 commit 0775c0d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

command/nohup.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,16 @@ nohup wget site.com/file.zip
4747
nohup ping -c 10 baidu.com
4848
```
4949

50+
### 最简单的后台运行
51+
nohup command &
52+
### 输出默认重定向到当前目录下 nohup.out 文件
53+
nohup python main.py &
54+
### 自定义输出文件(标准输出和错误输出合并到 main.log)
55+
nohup python main.py >> main.log 2>&1 &
56+
### 与上一个例子相同作用的简写方法
57+
nohup python main.py &> main.log &
58+
### 不记录输出信息
59+
nohup python main.py &> /dev/null &
60+
### 不记录输出信息并将程序的进程号写入 pidfile.txt 文件中,方便后续杀死进程
61+
nohup python main.py &> /dev/null & echo $! > pidfile.txt
5062

0 commit comments

Comments
 (0)