How to start Rails from a shell script on Debian?

Posted by dsp_099 on Server Fault See other posts from Server Fault or by dsp_099
Published on 2013-10-25T14:07:13Z Indexed on 2013/11/04 3:57 UTC
Read the original article Hit count: 569

I don't really have any need to mess with passenger or capistrano at the moment. I simply want to run rails on boot on port 3000. I've attempted to replicate this tutorial for node as much as I could to run rails:

I've a railsup script in /etc/init.d/ that goes something like:

#!/bin/sh
export PATH=$PATH:/usr/local/bin

case "$1" in
  start)
   cd /root/rails_app; /usr/local/rvm/gems/ruby-2.0.0-p247/bin/rails server -d -p 3005
  ;;
  # starting other stuff
*)

I've also included it with update-rc.d

I got it to work, but only if I run the script manually - it doesn't seem to run on boot. Is there any reason why ../bin/rails is unavailable on boot?

I imagine there's something about ruby path \ rvm \ rails that I'm unaware of? Is there a way to use crontab's @reboot for this?

© Server Fault or respective owner

Related posts about debian

Related posts about ruby-on-rails