如何将已经在运行的进程放在 nohup 下? [英] How do I put an already-running process under nohup?

查看:59
本文介绍了如何将已经在运行的进程放在 nohup 下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个进程已经运行了很长时间,不想结束它.

I have a process that is already running for a long time and don't want to end it.

如何将其置于 nohup 下(即,即使关闭终端,如何使其继续运行?)

How do I put it under nohup (that is, how do I cause it to continue running even if I close the terminal?)

推荐答案

使用 bash的Job Control将进程发送到后台:

Using the Job Control of bash to send the process into the background:

  1. Ctrl+Z 停止(暂停)程序并返回到 shell.
  2. bg 在后台运行它.
  3. disown -h [job-spec] 其中 [job-spec] 是作业编号(例如 %1 表示第一个正在运行的作业;查找您的编号jobs 命令),以便在终端关闭时不会终止作业.
  1. Ctrl+Z to stop (pause) the program and get back to the shell.
  2. bg to run it in the background.
  3. disown -h [job-spec] where [job-spec] is the job number (like %1 for the first running job; find about your number with the jobs command) so that the job isn't killed when the terminal closes.

这篇关于如何将已经在运行的进程放在 nohup 下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆