Capistrano Cron Rails - Crontab created, but not running

86 Views Asked by At

Capistrano, Whenever, Rails.

Using Whenever and Capistrano I pushed new data to the crontab on my server.

$ crontab -l

# Begin Whenever generated tasks for: myAPP
* * * * * /bin/bash -l -c 'cd /home/.../apps/myAPP/releases/20184..1433 && bin/rails runner -e production '\''myModel.new.HELLO()'\'''
# End Whenever generated tasks for: myAPP

myModel -> HELLO()

def HELLO()
  p "HELLO"
end

How do I know if this is working? I don't think it is because the logs are blank. What am I doing wrong?

thanks

1

There are 1 best solutions below

0
On

p "HELLO" just prints to stdout, which doesn't do much good in a cronjob context. Try this code instead:

def HELLO()
  Rails.logger.info "HELLO"
end

This will print the message to the standard Rails log file. By default, this will be logs/production.log in the current release that Capistrano deployed.