doc: update command/nohup.md
This commit is contained in:
parent
0775c0d74e
commit
a6207d7ab2
|
|
@ -11,7 +11,9 @@ nohup
|
|||
|
||||
### 语法
|
||||
|
||||
```shell
|
||||
nohup(选项)(参数)
|
||||
```
|
||||
|
||||
### 选项
|
||||
|
||||
|
|
@ -26,7 +28,6 @@ nohup(选项)(参数)
|
|||
|
||||
### 实例
|
||||
|
||||
|
||||
使用nohup命令提交作业,如果使用nohup命令提交作业,那么在缺省情况下该作业的所有输出都被重定向到一个名为nohup.out的文件中,除非另外指定了输出文件:
|
||||
|
||||
```shell
|
||||
|
|
@ -47,16 +48,38 @@ nohup wget site.com/file.zip
|
|||
nohup ping -c 10 baidu.com
|
||||
```
|
||||
|
||||
### 最简单的后台运行
|
||||
nohup command &
|
||||
### 输出默认重定向到当前目录下 nohup.out 文件
|
||||
nohup python main.py &
|
||||
### 自定义输出文件(标准输出和错误输出合并到 main.log)
|
||||
nohup python main.py >> main.log 2>&1 &
|
||||
### 与上一个例子相同作用的简写方法
|
||||
nohup python main.py &> main.log &
|
||||
### 不记录输出信息
|
||||
nohup python main.py &> /dev/null &
|
||||
### 不记录输出信息并将程序的进程号写入 pidfile.txt 文件中,方便后续杀死进程
|
||||
nohup python main.py &> /dev/null & echo $! > pidfile.txt
|
||||
最简单的后台运行
|
||||
|
||||
```shell
|
||||
nohup command &
|
||||
```
|
||||
|
||||
输出默认重定向到当前目录下 nohup.out 文件
|
||||
|
||||
```shell
|
||||
nohup python main.py &
|
||||
```
|
||||
|
||||
自定义输出文件(标准输出和错误输出合并到 main.log)
|
||||
|
||||
```shell
|
||||
nohup python main.py >> main.log 2>&1 &
|
||||
```
|
||||
|
||||
与上一个例子相同作用的简写方法
|
||||
|
||||
```shell
|
||||
nohup python main.py &> main.log &
|
||||
```
|
||||
|
||||
不记录输出信息
|
||||
|
||||
```shell
|
||||
nohup python main.py &> /dev/null &
|
||||
```
|
||||
|
||||
不记录输出信息并将程序的进程号写入 pidfile.txt 文件中,方便后续杀死进程
|
||||
|
||||
```shell
|
||||
nohup python main.py &> /dev/null & echo $! > pidfile.txt
|
||||
```
|
||||
Loading…
Reference in New Issue