How to use a Rails cron job to run a program in Java?

0

Is it possible to use a cron job in Rails to execute a command that executes a class in Java? If so how?

    
asked by anonymous 18.06.2014 / 19:11

2 answers

0

You should use gem called whenever and it will keep your crontab in ruby code, the idea is to write all the rules together with deploy updating the crontab.

1st In your GemFile insert

gem 'whenever', :require => false

Create the schedule.rb

wheneverize .

3rd In the schedule.rb file

#aqui você pode definir a frequência que o código vai ser executado, ler readme do github
every 1.day, :at => '4:30 am' do
  command "java {chamada do programa java}"
end

On the server run the command to update the crontab table, if you are using capristano, put it in your deploy stream

whenever --update-crontab
    
23.06.2014 / 17:18
0

Rails does not have cron job, this is the task of the operating system. And yes, you can use cron to call a program in java, if it is callable by the command line.

    
21.06.2014 / 23:18