- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
假设我在后台启动了 Linux 进程。它不是守护进程,只是一个实用程序。如果它收到 SIGHUP,它就会被杀死。
我没有采取“nohup”预防措施。这已经比我想象的要花费更长的时间。
运行 4 小时后,ssh session 可能会断开连接。但我不想失去这个过程。
我想防止它被 SIGHUP 杀死。
是否有可能做出等同于
signal(SIGHUP, SIG_IGN);
在不重新启动这个进程的情况下?
谢谢
最佳答案
使用disown(1)
disown: disown [-h] [-ar] [jobspec ...] Remove jobs from current shell.
Removes each JOBSPEC argument from the table of active jobs. Without
any JOBSPECs, the shell uses its notion of the current job.
Options:
-a remove all jobs if JOBSPEC is not supplied
-h mark each JOBSPEC so that SIGHUP is not sent to the job if
the shell receives a SIGHUP
-r remove only running jobs
Detaching a process from terminal, entirely
"disown" is a bash builtin that removes a shell job from the shell's job list. What this basically means is that you can't use "fg", "bg" on it anymore, but more importantly, when you close your shell it won't hang or send a SIGHUP to that child anymore. Unlike "nohup", "disown" is used after the process has been launched and backgrounded.
关于linux - 更改已运行进程的信号处理 (SIGHUP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6090160/
专家们,我有一个通过 ssh 连接到服务器的客户端(它分配了一个 tty)。我有一个在服务器上运行的进程 A。现在,无论何时客户端断开连接,我都需要 A 知道消失的 tty。 我在想,既然 SSHD
假设我在后台启动了 Linux 进程。它不是守护进程,只是一个实用程序。如果它收到 SIGHUP,它就会被杀死。 我没有采取“nohup”预防措施。这已经比我想象的要花费更长的时间。 运行 4 小时后
根据signal(7),SIGHUP用于检测控制终端挂断或控制进程死亡。 但是,我遇到过很多 OSS 守护进程(服务),其中 SIGHUP 用于启动配置的重新加载。下面是几个示例:hostapd、ss
您能解释一下UNIX信号系统的逻辑吗:尽管SIGHUP的主要思想是“杀死你自己,不再有终端了”,但它首先向进程组发送SIGHUP信号,然后发送SIGCONT信号? 最佳答案 如果进程因 SIGSTOP
我有一个经典问题,但不知道如何处理它。有一个执行子进程的 bash 进程,我想向它发送一些信号(SIGHUP),在那里处理它并将该信号传播给其中一个子进程(例如 another_long_runnin
我正在尝试使用 chef 运行 python 脚本,当 chef 由于 SIGHUP 退出时,该脚本将退出。我正在使用 nohup 但它仍然收到信号。有什么想法可以让这个脚本在后台运行吗? nohup
#include #include #include #include void handler (int sig); int count; int main() { struct s
我有一个进程,想在它被杀死后重新启动它。为此,我启动了子“监护人”进程,该进程使用 prctl(PR_SET_PDEATHSIG, SIGHUP); 捕获其父级的杀戮并再次启动它。 这里是监护人的代码
在 GNU libc 手册中关于 orphaned process groups ,它提到: “process groups that continue running even after the
我正在读一本关于Unix系统编程的书。书上有一个创建守护进程的函数。 部分代码我不太清楚,特别是以下内容: struct sigaction sa; .... /* *Become a sess
当终端断开连接时,内核将通过向控制终端发送 SIGHUP 来通知它。之后,控制进程向同一 session 中的所有进程发送SIGHUP。当这些进程捕获 SIGHUP 但执行其他操作而不是在信号处理程序
是否可以立即启动由 pthread_create 创建的线程,而无需等待 ~300us 使其启动?现在,现有代码正在通过向线程发送 SIGHUP 来“快速启动”线程,但是,副作用是如果主进程没有为 设
我使用 Leiningen REPL,它使用 SIGINT 来中断当前正在运行的代码并输出新提示。可以使用 SIGHUP 或 SIGKILL 停止 REPL。我实际上并没有在 REPL 中运行任何东西
我们有一些应用程序调用连接到 Oracle 数据库的 PHP 脚本来执行某些操作。 :) 有时效果不佳。 我们现在从一开始就通过 strace 运行 PHP 部分。 这是一切正常时的样子(一切正常,数
运行时间: mehoggan@mehoggan-laptop:~/Code/svn_playground/C++/timer/timer0$ uname -a Linux mehoggan-lapto
正如我们所知,当 ssh 连接断开时,bash 将收到一个 SIGHUP,并将此信号转发给它的所有子级。 我想知道这个 SIGHUP 的原始发送者是谁,是 ssh 客户端、ssh 服务器、操作系统还是
APUE 说 Since the process group is orphaned when the parentterminates, POSIX.1 requires that every pr
我正在尝试发送 SIGHUP 使用 PHP 向外部进程发送信号。目前,我正在执行以下操作: $pid = shell_exec('ps -ef | grep mosquitto | grep -v g
想在我的服务器上搜索特定文件并直接在 nano 中编辑它。 我试过这样,但它不会工作 find -name file.php | xargs nano $1 该文件已找到,但它不会像那样工作 Rece
你好 文本编辑器nano has this feature ,当编辑器收到 SIGHUP 或 SIGTERM 或内存不足时创建一个保存文件。 在这种情况下,nano 将当前编辑器内容写入名为 nano
我是一名优秀的程序员,十分优秀!