Upstart node.js working directory

别来无恙 提交于 2019-11-30 11:49:10

The solution is to change directory within the script. In my case, the user is mynodeapp and the node files are in the users directory (/home/mynodeapp/).

script
        chdir /home/mynodeapp/
        echo $$ > /var/run/mynodeapp.pid
        exec sudo -u mynodeapp node server.js >> /var/log/mynodeapp.sys.log 2>&1
end script

I have yet to find out what $$ means on the echo line or 2>&1. Maybe somebody could chime in with this if they know!

You should use the chdir stanza as per the Upstart docs: http://upstart.ubuntu.com/cookbook/#chdir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!