5

如何比较方便的杀死 nohup 起的进程及其所有子进程?

 2 years ago
source link: https://www.v2ex.com/t/802716
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Linux

如何比较方便的杀死 nohup 起的进程及其所有子进程?

  ffxung · 3 小时 7 分钟前 · 639 次点击

主控程序是一个 shell 脚本(如main.sh),里面会启动一下子进程. 直接执行时, 可以用kill -- -PPID(主进程号前有个负号)的方式杀掉主进程和所有子进程, 但发现用 nohup 启动主进程的话, 用这种方式失效了, 提示 kill: (-7228) - No such process (7228 是main.sh的 pid). 求助, 如何比较方便的杀死 nohup 起的进程及其所有子进程? 网上查了不少资料,但没有找到特别方便的方式.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK