我有一个简单的Node / Express服务器永远运行
forever start forever_app_config.json
我的配置文件看起来像这样
{
"uid": "myapp",
"append": true,
"watch": true,
"script": "app.js",
"sourceDir": "/data/projects/myapp"
}
一切正常。但是在尝试添加服务时(/usr/lib/systemd/system/mayapp.service
)
[Unit]
Description = My Service
[Service]
User = centos
Group = centos
Environment = NODE_ENV=production
Environment = PORT=3333
ExecStart = /usr/bin/forever start /data/projects/myapp/forever_app_config.json
ExecStop = /usr/bin/forever stop myapp
[Install]
WantedBy = multi-user.target
由于某些原因它无效:sudo systemctl start myapp -l
myapp.service - My Service
Loaded: loaded (/usr/lib/systemd/system/myapp.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Mon 2018-02-19 11:43:08 UTC; 12min ago
Process: 26685 ExecStop=/usr/bin/forever stop malcazar (code=exited, status=0/SUCCESS)
Process: 26674 ExecStart=/usr/bin/forever start /data/projects/myapp/forever_app_config.json (code=exited, status=0/SUCCESS)
Main PID: 26674 (code=exited, status=0/SUCCESS)
和永远日志(/home/centos/.forever/myapp.log
)显示如下错误:
error: Forever detected script was killed by signal: SIGKILL
。
那么,我的配置出了什么问题?
答案 0 :(得分:0)
最奇怪的是通过重新安装foreverjs来解决问题
● myapp.service - My Service
Loaded: loaded (/usr/lib/systemd/system/myapp.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-02-22 17:37:43 UTC; 4min 17s ago
Main PID: 8121 (node)
CGroup: /system.slice/myapp.service
├─8121 node /usr/bin/forever /data/projects/myapp/forever_app_config.json
└─8244 /usr/bin/node /data/projects/myapp/app.js
我几乎可以肯定sudo npm install forever -g
并非如此,但它现在对我有用,所以关闭这个问题。
答案 1 :(得分:0)
我已通过迁移到MonthProfit[0].Values = new ChartValues<decimal>(Enumerable.Repeat(0m, 30));
而不是永久使用来解决此问题。
http://pm2.keymetrics.io/docs/usage/quick-start/