1
airqj 2017-11-13 00:09:58 +08:00 via Android
reboot
简单粗暴 |
2
msg7086 2017-11-13 04:39:13 +08:00
用 cgroup 管理?
|
3
wakiki 2017-11-13 08:11:43 +08:00 via iPhone
负的 process id
|
4
pagxir 2017-11-13 08:34:00 +08:00
建组,然后直接杀进程组吧。
|
5
dorothyREN 2017-11-13 09:18:38 +08:00 1
pkill processName
|
6
metrue 2017-11-13 13:25:49 +08:00 1
```
const spawn = require('child_process').spawn; const script = `${__dirname}/timeout_task.sh`; const p = spawn(script, { detached: false, shell: true }); p.stdout.on('data', (data) => { // do something }); p.stderr.on('data', (data) => { // do something }); p.on('exit', (err) => { // do something }); setTimeout(() => { console.log(process.kill(-p.pid, 'SIGKILL')); }, 1000); ``` |
7
zqjnew 2017-11-13 22:53:37 +08:00 1
A 进程里开 fork B 进程,B 进程里再开 N 进程,关闭,直接关 B 进程即可
|