Node.js background running method

forever
forever can do more things, such as recording output and error logs separately, restarting after downtime, and hot deployment. For example, you can use
2.1 as an api in js to install forever
npm install forever -g
2.2 start the service
service forever npm start (here is the server start command if it is npm start)
2.2 use forever to start the js file
forever start app.js
2.3 stop the js file
forever stop app.js
2.4 Start the js file and output the log file
forever start -l forever.log -o out.log -e err.log app.js
2.5 Restart the js file
forever restart app.js
2.6 View the running process
forever list

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325258797&siteId=291194637