いつでも宝石で私はすべてを正しくしています。また、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'
すべての間隔の後に実行し続けるために何をしますか?