OSX launchd plist for node forever process

前端 未结 5 487
旧时难觅i
旧时难觅i 2021-02-03 12:24

I am trying to write a launchd.plist file for my node server. I am using forever to run my node server. I would like the server to start on boot. I would also like to wait fo

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-03 13:05

    This is not an answer of the original questions, but I was looking for a simple way to start a node server (and keep it running) after reboot. I found pm2 to be a much easier to set up than the solutions for forever above.

    # install pm2
    npm install pm2 -g
    
    # start server
    pm2 start app.js
    
    # start pm2 after reboot (might need sudo)
    $ pm2 startup
    

    http://pm2.keymetrics.io/docs/usage/startup/

提交回复
热议问题