本文介绍了有没有办法弄清楚为什么错误日志为空时PM2进程会重新启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ pm2 --version
1.1.1

使用 pm2 启动Shell脚本.它要运行大约12个小时.第二天回去检查它,只是完成了一半.但是我检查了日志,看起来好像已经重新开始了.检查了 pm2 ls ,是的,它有3次.这似乎很奇怪,因为它所做的只是发送一些卷发,并且已经好几个小时了.

Started a shell script with pm2. It was gonna run for about 12 hours. Went back to check on it the next day and it was only halfway done. But I checked the logs and it looked like it had started over. Checked pm2 ls and yes, it had, 3 times. That seemed strange since all it was doing was sending some curls and had been doing fine for hours.

所以我去看看错误输出:

So I went to look at the error output:

[collumj@serverName ~]$ ll /opt/xyz/.pm2/logs | grep util-perf-testing

-rw-r--r-- 1 collumj alskdjflkas    0 Oct 12 21:27 util-perf-testing-error-54.log
-rw-r--r-- 1 collumj alskdjflkas    0 Oct 12 21:38 util-perf-testing-error-59.log
-rw-r--r-- 1 collumj alskdjflkas 6.8K Oct 12 21:36 util-perf-testing-out-54.log
-rw-r--r-- 1 collumj alskdjflkas  15K Oct 13 00:00 util-perf-testing-out-59__2016-10-13_00-00-00.log
-rw-r--r-- 1 collumj alskdjflkas 166K Oct 14 00:00 util-perf-testing-out-59__2016-10-14_00-00-00.log
-rw-r--r-- 1 collumj alskdjflkas 384K Oct 14 17:16 util-perf-testing-out-59.log

两个错误日志完全为空.

The two error logs are completely empty.

PM2是否保留有关重启的任何内部日志?Shell脚本的输出未显示重新启动它的任何原因,并且错误日志为空.我正在寻找一个完全神秘的东西,为什么这个Shell脚本会重新启动3次.

Does PM2 keep any sort of internal logs about restarts? The output of the shell script doesn't show any reason for it to restart and the error logs are empty. I'm looking at a complete mystery as to why this shell script would have restarted 3 times.

推荐答案

PM2将在其日志中存储重置原因,可以这样访问: tail --lines 100〜/.pm2/pm2.日志.

PM2 will store the reasons for resets in its log, which can be accessed like so: tail --lines 100 ~/.pm2/pm2.log.

这篇关于有没有办法弄清楚为什么错误日志为空时PM2进程会重新启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 14:31