I have a Rails application which uses Resque for a job queue. The Resque worker class is "JobDo" and is in app/workers/job_do.rb
I have a script (jobdo.sh) which will put a job onto the queue:
jruby -e 'load "/home/abc/myapp/app/workers/job_do.rb"; Resque.enqueue(JobDo, Time.now.utc)' >> /home/abc/logs/resque.log 2>&1
However...I would like to be able to run this in a rails environment which doesn't use the same log file, user, or rails application root. I see doing something like this:
export $USER_HOME=/home/abc
export $LOGFILE=$USER_HOME/logs/resque.log
export $SERVER_HOME=/home/abc/myapp
jruby -e 'load "$SERVER_HOME/app/workers/job_do.rb"; Resque.enqueue(JobDo,Time.now.utc)' >> $LOGFILE 2>&1
This would let any user edit $USER_HOME and $SERVER_HOME and run the code in their environment.
However, this doesn't work because I cannot figure out how to twiddle the single and double quotes to use the environment variables. How do I do this?