title: Run delayed jobs after deployed on production server
body: <p>With the delayed_jobs gem(<a href="https://github.com/collectiveidea/delayed_job" rel="nofollow">https://github.com/collectiveidea/delayed_job</a>) in rails, I am able to queue my notifications. But I don't quite understand how can I run the queued jobs on the production server. I knew I can just run </p>
  
  <pre><code>$ rake jobs:work
  </code></pre>
  
  <p>in the console for the local server. As the documentation said,
  You can then do the following:</p>
  
  <pre><code>RAILS_ENV=production script/delayed_job start
  RAILS_ENV=production script/delayed_job stop
  
  # Runs two workers in separate processes.
  RAILS_ENV=production script/delayed_job -n 2 start
  RAILS_ENV=production script/delayed_job stop
  
  # Set the --queue or --queues option to work from a particular queue.
  RAILS_ENV=production script/delayed_job --queue=tracking start
  RAILS_ENV=production script/delayed_job --queues=mailers,tasks start
  
  # Runs all available jobs and the exits
  RAILS_ENV=production script/delayed_job start --exit-on-complete
  # or to run in the foreground
  RAILS_ENV=production script/delayed_job run --exit-on-complete
  </code></pre>
  
  <p>My question is how to integrate it with my Rails app?I was thinking to create a file called delayed_jobs.rb in config/initializers as:</p>
  
  <pre><code># in config/initializers/delayed_jobs
  script/delayed_job start if Rails.env.production?
  </code></pre>
  
  <p>But I am not sure if it is the right way to do with it. Thanks</p>