要求:将一个正在当前前台执行的进程转入后台执行,并且要求退出shell后依然保持不退出进程。
  1. ctrl+zto stop (pause) the program and get back to the shell

  2. bgto run it in the background

  3. disown -h [job-spec]where [job-spec] is the job number (like%1for the first running job; find about your number with thejobscommand) so that the job isn't killed when the terminal closes


操作如下:
[root@dispatch_19 gcc-4.8.1]# cd /home/machen/vv_cold_algorithm/movie_score_builder && /usr/local/bin/python view_record_manage.py save 1
13-12-28 13:50:49 ./logs/view_record.log INFO   start calculate delta data
13-12-28 13:50:49 ./logs/view_record.log INFO   hdfs:/data/dm/recommend/recom_yvv/20131227
first fresh...


ctrl+z
[1]+  Stopped                 /usr/local/bin/python view_record_manage.py save 1
[root@dispatch_19 movie_score_builder]# bg
[1]+ /usr/local/bin/python view_record_manage.py save 1 &
[root@dispatch_19 movie_score_builder]# jobs
[ 1]+  Running                 /usr/local/bin/python view_record_manage.py save 1 &
[root@dispatch_19 movie_score_builder]# disown  -h % 1