nohup command &

chhandsome 2015-08-19

[root@linuxstudy testshell]# jobs -l
[1]+  2568 Running                 nohup python pytest1.py &
[root@linuxstudy testshell]# bg %1
-bash: bg: job 1 already in background
[root@linuxstudy testshell]# jobs
[1]+  Running                 nohup python pytest1.py &
[root@linuxstudy testshell]# jobs
[1]+  Running                 nohup python pytest1.py &
[root@linuxstudy testshell]# jobs
[1]+  Running                 nohup python pytest1.py &
[root@linuxstudy testshell]# jobs -l
[1]+  2568 Running                 nohup python pytest1.py &
[root@linuxstudy testshell]# nohup python pytest1.py &
[2] 2572
[root@linuxstudy testshell]# nohup: ignoring input and appending output to `nohup.out'

[root@linuxstudy testshell]# jobs -l
[1]-  2568 Running                 nohup python pytest1.py &
[2]+  2572 Running                 nohup python pytest1.py &
[root@linuxstudy testshell]# fg %2
nohup python pytest1.py
fg %1

^C[root@linuxstudy testshell]# jobs -l
[1]+  2568 Running                 nohup python pytest1.py &
[root@linuxstudy testshell]# fg %1
nohup python pytest1.py
^C[root@linuxstudy testshell]#

[root@linuxstudy testshell]# cat pytest1.py
#!/usr/bin/env python

import os,time

while True:
        print time.time()
        time.sleep(3)



[root@linuxstudy testshell]# cat s3.sh
#!/bin/sh

echo 'python runs in backend'

python pytest1.py &

[root@linuxstudy testshell]#

root      2588  0.0  0.3 117180  3656 pts/0    S    07:35   0:00 python pytest1.py
root      2614  0.0  0.0 103252   824 pts/1    S+   07:36   0:00 grep py

相关推荐

xiaodaiwang / 0评论 2019-11-04