How do I run WEBrick as an upstart job?

1

I need to get WEBrick (basically a Rails web server) to work using upstart, but cannot figure out what should I write in script.

The following gives me an error:

chdir /rails-app

exec su -s /bin/sh -c 'exec "$0" "$@"' myuser -- rails server -e production

start on runlevel [2345]
stop on runlevel [^2345]

(the error is rails: 1: exec: rails: not found)

Ruby is installed via rvm, so probably I should try something like :

exec su -s /bin/sh -c 'exec "$0" "$@"' myuser -- /home/myuser/.rvm/gems/ruby-1.9.3-p385/bin/bundle exec rails server -e production

But this doesn't work too (/usr/bin/env: ruby_noexec_wrapper: No such file or directory).

How do I run WEBrick as an upstart job?

Nik

Posted 2013-05-19T22:18:47.930

Reputation: 169

No answers