Start rails server automatically when ever I start my ubuntu machine

前端 未结 2 1031
半阙折子戏
半阙折子戏 2020-12-31 09:38

I have a rails application and I want to start the server automatically whenever the machine boots up. Right now I cd to the directory and then type the rails s

2条回答
  •  [愿得一人]
    2020-12-31 10:00

    @reboot /bin/bash -l -c 'cd PATH_TO_PROJECT && rails s'
    

    did the trick for me. You might need to reload RVM and for that

    @reboot /bin/bash -l -c 'cd PATH_TO_PROJECT && source ~/.rvm/scripts/rvm && rvm use ruby-RUBY_VERSION_HERE && rails s'
    

    will serve the purpose.

提交回复
热议问题