Note that there are some explanatory texts on larger screens.

plurals
  1. POManage sidekiq with init.d script using RVM
    primarykey
    data
    text
    <p>I'm using the init.d script provided (the <a href="https://github.com/mperham/sidekiq/blob/master/examples/sidekiq" rel="nofollow">init.d script from the sidekiq github repo</a>), but I am on an ubuntu system with RVM installed system wide.</p> <p>I cannot seem to figure out how to cd into my app directory and issue the command without there being some complaining in the log and nothing actually starting.</p> <p><strong>Question</strong>: What should the startup command for sidekiq look like in my init.d script when I am using RVM? My user is named ubuntu. Currently I have this in my init.d script:</p> <pre><code>START_CMD="$BUNDLE exec $SIDEKIQ" # where bundle is /usr/local/rvm/gems/ruby-1.9.3-p385/bin/bundle # and sidekiq is sidekiq # I've also tried with the following args: -e $APP_ENV -P $PID_FILE -C $APP_CONFIG/sidekiq.yml -d -L $LOG_FILE" RETVAL=0 start() { status if [ $? -eq 1 ]; then [ `id -u` == '0' ] || (echo "$SIDEKIQ runs as root only .."; exit 5) [ -d $APP_DIR ] || (echo "$APP_DIR not found!.. Exiting"; exit 6) cd $APP_DIR echo "Starting $SIDEKIQ message processor .. " echo "in dir `pwd`" su - ubuntu -c "$START_CMD &gt;&gt; $LOG_FILE 2&gt;&amp;1 &amp;" RETVAL=$? #Sleeping for 8 seconds for process to be precisely visible in process table - See status () sleep 8 [ $RETVAL -eq 0 ] &amp;&amp; touch $LOCK_FILE return $RETVAL else echo "$SIDEKIQ message processor is already running .. " fi } </code></pre> <p>My sidekiq.log gives me this error:<code>Could not locate Gemfile</code>. However, I print the working directory and I am most definitely in my app's current directory, according to the echo pwd, at the time this command is executed.</p> <p>When I take out the su - ubuntu -c [command here], I get this error: </p> <pre><code>/usr/bin/env: ruby_noexec_wrapper: No such file or directory </code></pre> <p>My solution is to just start the process manually. When I manually cd into my app directory and issue this command:</p> <p><code>bundle exec sidekiq -d -L log/sidekiq.log -P tmp/pids/sidekiq.pid</code> </p> <p>things go as planned, and then </p> <p><code>sudo /etc/init.d/sidekiq status</code> </p> <p>tells me things are up and running.</p> <p>Also, sudo /etc/init.d/sidekiq stop and status work as expected.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload