最初配置的ecosystem.config.js
module.exports = {
apps: [
{
name: 'development_platform_server',
script: 'bin/www',
instances: 1,
autorestart: true,
watch: true,
out_file: './logs/out.log',
error_file: './logs/error.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss',
max_memory_restart: '500M'
}
]
}
然後就無限重啓了
從下面的錯誤日誌中可以發現, logs文件內的文件改變,觸發了 watch 的監聽檢測。
error: Change detected on path logs/error-0.log for app development_platform_server
修改後的ecosystem.config.js,使用ignore_watch
屬性去忽略一些不想監聽的。
module.exports = {
apps: [
{
name: 'development_platform_server',
script: 'bin/www',
instances: 1,
autorestart: true,
watch: true,
out_file: './logs/out.log',
error_file: './logs/error.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss',
max_memory_restart: '500M',
ignore_watch: 'logs'
}
]
}