【发布时间】:2016-02-07 19:37:13
【问题描述】:
我遵循了每当 gems 网站上的说明,并尝试在服务器上的开发和生产模式下都遵循它。
set :output, "/file/to/path/cron.log"
every 1.day, at: '11:59 pm' do
command "sudo touch /file/to/path"
runner "Location.transfer_data",:environment => 'production'
end
它不会创建文件(这是一个测试,因为我没有生产数据)。
我花了几个小时尝试调试它,crontab -l 给了我这个输出
59 23 * * * /bin/bash -l -c 'sudo touch /file/to/path >> /file/to/path/cron.log 2>&1'
59 23 * * * /bin/bash -l -c 'cd /var/www/name && script/rails runner -e production '\''Location.transfer_data'\'' >> /file/to/path/cron.log 2>&1'
问候,
巴巴尔·雷曼
【问题讨论】:
-
我现在如何编辑它?
-
@Babar 你检查了
log info和transfer_data的写法吗?? -
我使用了 Rails 控制台日志记录,但也没有显示在日志文件中。
标签: ruby-on-rails ruby linux bash cron