0

在宝石上,我把一切都做好了。并且可以更新 schedule.rb 文件,但不会在每个时间间隔后获取日志。这是代码

这是计划文件

every 2.minutes do
 command "echo 'you can use raw cron sytax too'"
 rake "ftp" 
end 

这是 lib/tasks/ 中的 ftp.rake 文件

require 'net/ftp'
require 'timeout'
require 'pathname'
require 'fileutils'
task :ftp do
    command "echo 'you can use raw cron sytax too'"
    ftp = nil
    f = File.open("/home/hb/demo_haml/log/ftp_transfer.log","w+")    
    f.write("\n#{Time.now}")
    ftp = Net::FTP::new("192.168.x.x")
    ftp.login("demo", "demo")
    ftp.chdir("/home/hd")
    ftp.getbinaryfile("one.conf", "/home/hb/demo_haml/conf/one.conf", 1024)
    ftp.close if ftp
    f.close
end 

在此之后,当我开火时,我第一次得到了日志上的时间 whenever --update-crontab store

跑步crontab -l

# Begin Whenever generated tasks for: demo_haml
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c 'echo '\''you can use raw cron sytax too'\'''

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c 'cd /home/hb/applications/other_old_apps/Arpit/demo_haml && RAILS_ENV=production bundle exec rake ftp --silent'

每次间隔后如何继续执行?

4

0 回答 0