配置monitrc监视节点js app进程,找不到运行屏幕ec2 linux的节点app pidfile

Lia*_*atz 1 linux pid gnu-screen monit node.js

我在我的ec2 linux实例上通过屏幕运行我的app.js(节点js应用程序).我正在尝试配置我的monitrc文件,我需要app pidfile.它不在:/ var/run(并且没有/ var/www)

如果有人知道pidfile在哪里或者我怎么能找到它,真的很感激..
谢谢!

Rob*_*lga 5

在您的应用程序中,您可以使用process.pid获取当前的pid号码

var fs = require('fs');
fs.writeFile("/tmp/pidfile", process.pid);
Run Code Online (Sandbox Code Playgroud)

你在tmp得到一个pid文件