[英]How to create a start/stop/restart Linux service for Sails.js
I want to create a start/stop/restart service on Linux for Sails.js . 我想在Linux上为Sails.js创建启动/停止/重启服务。
Will start Sails (similar to sails lift
command): 将启动帆(类似于
sails lift
命令):
sudo service myapp start
Will stop Sails: 将停止航行:
sudo service myapp stop
Will restart Sails: 将重新启动Sails:
sudo service myapp restart
I found this link , but it doesn't work as expected. 我找到了此链接 ,但无法正常工作。
You need node-linux , configuration guidelines are given on the github page 您需要node-linux,配置指南在github页面上给出
Following is an example config you can use 以下是您可以使用的示例配置
var Service = require('node-linux').Service;
// Create a new service object
var svc = new Service({
name:'sails app',
description: 'sails application',
script: '/path/to/app.js'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.