mercredi 13 novembre 2019

Task not running using whenever gem but runs in command prompt

Task File

require 'report.rb'
require 'rake'

    namespace :daily_report do
      desc "Daily Parakh Report"
      task daily_operator_report: :environment do
        puts "Daily report generation started"
        Reports::Report.generate_csv
        puts "finished"
      end
    end

schedule.rb file

env :PATH, ENV['PATH']

set :output, "home/rajdeep/police-api/log/whenever.log"

every 1.day, :at => "06:46PM" do # Many shortcuts available: :hour, :day, :month, :year, :reboot
  rake "daily_report:daily_operator_report"
end

When the clock hits the speicified time in whenever.rb file nothing happens, the task doesn't run, even whenever.log file is not created.

when i run rake daily_report:daily_operator_report it works.

Aucun commentaire:

Enregistrer un commentaire