-1

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

Marcus
  • 9,032
  • 11
  • 45
  • 84

1 Answers1

1

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.

Matt Brictson
  • 10,904
  • 1
  • 38
  • 43