[英]Check if nodejs is running in screen
I have a few nodejs processes running in different screens on a ubunutu-server. 我在ubunutu服务器的不同屏幕上运行了几个nodejs进程。 If a process in one of these screens crashed I'd like to have a script which automatically restarts the node script in the background. 如果这些屏幕之一中的进程崩溃了,我希望有一个脚本可以在后台自动重启节点脚本。 I always get solutions only checking if node is installed... is there a way to check and solve this? 我总是得到仅检查是否已安装节点的解决方案...是否可以检查并解决此问题?
You could write a simple loop that starts whatever script you need, in this case npm start
: 您可以编写一个简单的循环来启动所需的任何脚本,在本例中为npm start
:
while true
do
npm start
done
You can add an &
at the end if you need to. 如果需要,可以在末尾添加&
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.