-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

4

1 回答 1

1

p "HELLO"只是打印到标准输出,这在 cronjob 上下文中没有多大用处。试试这个代码:

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

这会将消息打印到标准 Rails 日志文件。默认情况下,这将logs/production.log在 Capistrano 部署的当前版本中。

于 2015-08-04T23:53:23.600 回答