当账户用完进程时如何杀死并重新启动nodejs。
Using username "shee".
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
[shee@sg9 ~]$ ps
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ ls
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ free
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$
我在 fastcomet.com 上运行 nodejs
cPanel Version 68.0 (build 37)
Apache Version 2.4.33
Operating System linux
Kernel Version 2.6.32-896.16.1.lve1.4.51.el6.x86_64
我正在使用 pm2 来运行 nodejs
但正如您上面看到的 - 每个命令都会给出错误“fork:无法分配内存”
cPanel 显示:进程数 40 / 40 ( 100% )
关于如何终止该进程,有什么想法吗?
答案1
FastComet 团队在这里!
只要您知道 PID 是什么,终止进程就相当容易。据我所知,您正在尝试正确的命令,但是您的帐户缺少内存来执行它。这是因为您正在运行 nodejs 实例以及 pm2 进程管理器,并且这两者合起来使用了所有内存。
遗憾的是,由于分配给您网站托管帐户的内存已 100% 使用,因此您无能为力。因此,我恳请您联系我们的技术支持团队,他们将很乐意帮助您在几分钟内解决问题。
谨致问候和良好祝愿,FastComet 团队
答案2
pkill 有效
我使用 pkill 来杀死节点和 pm2
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
[shee@sg9 ~]$
[shee@sg9:~ls
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ pkill node
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ pkill pm2
[shee@sg9 ~]$ pkill node
[shee@sg9 ~]$ pkill pm2
-bash: fork: Cannot allocate memory
N/A: version " -> N/A" is not yet installed.
You need to run "nvm install " to install it before using it.
[shee@sg9 ~]$ ls
access-logs etc node_modules public_html ssl tmp
master mail public_ftp treeftp start.sh www
[shee@sg9 ~]$