让进程在后台可靠运行

如果提交命令时未使用“&”将命令放入后台运行,可使用 CTRL-z 和“bg”将其放入后台,再使用“disown”

 

 

[root@pvcent107 build]# cp -r testLargeFile largeFile2



[1]+  Stopped                 cp -i -r testLargeFile largeFile2

[root@pvcent107 build]# bg %1

[1]+ cp -i -r testLargeFile largeFile2 &

[root@pvcent107 build]# jobs

[1]+  Running                 cp -i -r testLargeFile largeFile2 &

[root@pvcent107 build]# disown -h %1

[root@pvcent107 build]# ps -ef |grep largeFile2

root      5790  5577  1 10:04 pts/3    00:00:00 cp -i -r testLargeFile largeFile2

root      5824  5577  0 10:05 pts/3    00:00:00 grep largeFile2

[root@pvcent107 build]#   

 

你可能感兴趣的:(进程)