Monit bundle exec rails s

安稳与你 提交于 2019-11-29 17:18:14

As i expected, it was user-environment issue and i solved it by editing monit configuration as below:

Before (not working)

check process myapp
    matching ":4445"
    start program = "/bin/bash -c '/home/user/start-app.sh'" as uid "user" and gid "user"
    stop program = "/bin/bash -c /home/user/stop-app.sh" as uid "user" and gid "user"

After (working)

check process myapp
    matching ":4445"
    start program = "/bin/su -s /bin/bash -c '/home/user/start-app.sh' user"
    stop program = "/bin/su -s /bin/bash -c '/home/user/stop-app.sh' user"

Explanation: i removed (uid and gid) as "user" from monit because it will only execute the shell script in the name of "user" but it won't get/import/use user's env path, or env variables.

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