0

I wrote a rake task which executes from command line and not from cronjob.

I wrote a task which internally calls model method, so suppose my task name is dataimport so if I call as

rake db:dataimport

it works, and create records in database. But when I want execute it for every 10 seconds I putin crontab as

* * * * * sleep 10; cd $APP_DIR/lib/tasks; rake db:dataimport

this doesn't work.Any suggestions on this.

Sonalkumar sute
  • 2,565
  • 2
  • 17
  • 27

1 Answers1

0

For rake commands to execute, you need to set PATH variable in your crontab file

If you are using ubuntu linux then first execute 'crontab -e' command and then add the following line

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

at the top of the file.

scanE
  • 332
  • 4
  • 19