어떻게 셸 을 종료 한 후에 프로그램 을 계속 실행 합 니까?
1667 단어 운영 및 자동화
$ command &
$ jobs 查看后台进程(fg 转前台运行)
Ctrl + D (等价于命令logout,如果直接关闭窗口,进程依然会被关闭)
명령 은 이미 집행 되 었 다.
$ command
Ctrl + Z (进程转后台并stopped)
回显:
[1]+ Stopped command args...
这里方括号里的 “1” 指进程的作业编号是1,在bg命令中可以用%1来引用。
$ bg (stopped的作业进程转后台运行,且默认使第1个作业转后台运行)
回显:
[1]+ command args... &
表示作业1转后台运行。
$ bg %2 (使stopped的且作业编号为2的进程转后台运行)
$ fg (将作业1转前台运行)
$ fg %2 (将作业2转前台运行)
$ jobs (查看运行状态为Running)
Ctrl + D
프로그램 배경 에서 실행 하 는 추천 방법
$ nohup command &
上述命令执行后出现:
nohup: ignoring input and appending output to 'nohup.out'
可以重定向到一个文本文件
$ jobs
Ctrl + D 或关闭窗口,之后进程会在后台继续运行。