how to run a cron file

Hi all

I want to run this in production mode.

RAILS_ENV=production ruby script/runner lib/camp.rb in cron file.

what i have done in cron file is below

* * * * * RAILS_ENV=production /usr/bin/ruby /mnt/apps/NearbyAd/current/script/runner /mnt/apps/NearbyAd/current/lib/camp.rb

but i didn't get any success.

/usr/bin/ruby i got from which ruby

please help me.

Quoting Manish Nautiyal <lists@ruby-forum.com>:

Hi all

I want to run this in production mode.

RAILS_ENV=production ruby script/runner lib/camp.rb in cron file.

what i have done in cron file is below

* * * * * RAILS_ENV=production /usr/bin/ruby /mnt/apps/NearbyAd/current/script/runner /mnt/apps/NearbyAd/current/lib/camp.rb

Try

* * * * * cd /mnt/apps/NearbyAd/current; ./script/runner -e production lib/camp.rb

HTH,   Jeffrey

Jeffrey L. Taylor wrote:

Quoting Manish Nautiyal <lists@ruby-forum.com>:

/mnt/apps/NearbyAd/current/lib/camp.rb

Try

* * * * * cd /mnt/apps/NearbyAd/current; ./script/runner -e production lib/camp.rb

HTH,   Jeffrey

Thx Jeffrey Its work.

many many thanks

Quoting Manish Nautiyal <lists@ruby-forum.com>:

Jeffrey L. Taylor wrote: > Quoting Manish Nautiyal <lists@ruby-forum.com>: >> /mnt/apps/NearbyAd/current/lib/camp.rb >> > Try > > * * * * * cd /mnt/apps/NearbyAd/current; ./script/runner -e production > lib/camp.rb > > HTH, > Jeffrey

Thx Jeffrey Its work.

many many thanks

There are several things in Rails that assumes the current working directory is somewhere in the Rails application directory structure. For example, the following works also:

* * * * * cd /mnt/apps/NearbyAd/current/lib; ../script/runner -e production camp.rb

Jeffrey

first, you can debug the shell in the console until success. and you can write the shell in sh file,like this:

run.sh: export RAILS_ENV=production /usr/bin/ruby ~/1.rb .....

crontab file * * * * * sh ~/run.sh

Jeffrey L. Taylor wrote: