Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku scheduled job returns 'command not found' but works with a rake

I have a Heroku scheduled job that is supposed to run every 10 minutres. It simply makes a HTTP GET request to a controller's action which does something.

desc "This task is called by the Heroku scheduler add-on"
task :send_notifications => :environment do

   response = HTTParty.get('http://sendnotificationapp.com/sms/send_notifications')

end

When I do a rake, the task operates and functions properly:

heroku rake send_notifications

Though when I use the Heroku scheduler GUI to set it to run every 10 minutes, it doesn't operate. Instead I get the following error:

Starting process with command `send_notifications` by [email protected]
Starting process with command `send_notifications`
bash: send_notifications: command not found
Process exited with status 127

Any thoughts?

Thanks!

like image 765
dougiebuckets Avatar asked Nov 16 '12 20:11

dougiebuckets


People also ask

Is heroku scheduler reliable?

Reliable delivery Heroku Scheduler is a free add-on, but it doesn't guarantee that jobs will be executed at their scheduled time, or at all for that matter. While it is rare, the possibility that a job may be skipped or run twice does exist.

Can you run cron jobs on Heroku?

Quick and easy set up begins by attaching Cron To Go to a Heroku application via the following CLI: A list of all plans available can be found here. After you have provisioned Cron To Go, the dashboard is accessible for your use. You can now get started on defining and scheduling jobs.


1 Answers

Sounds like you set up the Heroku scheduler job to be send_notifications, rather than rake send_notifications or bundle exec rake send_notifications.

like image 60
willglynn Avatar answered Sep 20 '22 23:09

willglynn