Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 722143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:57:19+00:00 2026-05-14T05:57:19+00:00

I have managed to get a cron job to run a rake task by

  • 0

I have managed to get a cron job to run a rake task by doing the following:

cd /home/myusername/approotlocation/ && /usr/bin/rake sendnewsletter RAILS_ENV=development

i have checked with which ruby and which rake to make sure the paths are correct (from bash)

the job looks like it wants to run as i get the following email from the cron daemon when it completes

Missing these required gems:
      chronic  
      whenever  
      searchlogic  
      adzap-ar_mailer  
      twitter  
      gdata  
      bitly  
      ruby-recaptcha

You're running:
  ruby 1.8.7.22 at /usr/bin/ruby
  rubygems 1.3.5 at /home/myusername/gems, /usr/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.
(in /home/myusername/approotlocation)

my custom rake file within lib/tasks is as follows:

task :sendnewsletter => :environment do
 require 'rubygems'
 require 'chronic'  
 require 'whenever'  
 require 'searchlogic'  
 require 'adzap-ar_mailer'  
 require 'twitter'  
 require 'gdata'  
 require 'bitly'  
 require 'ruby-recaptcha'
   @recipients = Subscription.all(:conditions => {:active => true})
    for user in @recipients
      Email.send_later(:deliver_send_newsletter,user)
    end
end

with or without the require items, it still gives me the same error …

can anyone shed some light on this? or alternatively advise me on how to make a custom file within the script directory that will run this function (I already have a cron job working that will run and process all my delayed_jobs.

After Jonathans suggestion below I ran

env

as a cron job on its own and received the following output:

SHELL=/bin/sh
MAILTO=myemailaddress
USER=myusername
PATH=/usr/bin:/bin
PWD=/home/myusername
SHLVL=1
HOME=/home/myusername
LOGNAME= myusername
_=/usr/bin/env

does this mean it’s not loading the ruby files properly?
….
also took Jonathans advice and produced the following cron.sh file

#!/bin/sh
date
echo "Executing Matenia Rake Task"
PATH=/usr/bin:/bin
cd /home/myusername/approotlocation/
rake sendnewsletter

still getting the missing gems notice …
Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:57:19+00:00Added an answer on May 14, 2026 at 5:57 am

    Easiest way to fix this (but kind of a shotgun approche) is from your shell type

    env | grep PATH

    Then take this output and add it your crontab for that user

    so it would look something like this

    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    
    # m h dom mon dow user    command
    42 6 * * *        root    job1
    47 6 * * 7        root    job2
    52 6 1 * *        root    job3
    

    Just make sure your gems’s are inside of that path

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you managed to get Aptana Studio debugging to work? I tried following this,
I asked before about pixel-pushing, and have now managed to get far enough to
I have finally managed to get javan-whenever gem working on my site5 server, and
I have managed to get myself confused about some elements of memory management. I
I'm writing a MVC website and using jqGrid. I have managed to get it
I have managed to get header at the top, and content at the center.
If I have managed to locate and verify the existence of a file using
I have installed Delphi Prism and XNA Game Studio 3.0. I have managed to
I've deconstructed a standard WPF button using Blend and have managed to create a
At work I work closely with MS-Office. I have managed to generate some scripts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.