带轨道的cronjob - 每当宝石无所事事,为什么? (发展模式)

时间:2011-07-07 12:19:53

标签: ruby-on-rails ruby-on-rails-3 rubygems cron crontab

我正在尝试每晚自动备份我的数据库。我想使用when gem和我的应用程序仍在开发环境中运行。

我在app文件夹中使用了wheneverize .命令来创建config/schedule.rb文件,swhcih看起来像这样:

set :output, "/User/eveadmin/rails/feebacker/log/cron_log.log"
set :environment, "development"


every 1.day, :at => '2:30 am'  do
  dump_path = "/User/eveadmin/rails/db_backups/dump#{Date.today.to_s}"
  command "sudo mysqldump -u user -p secretpasswort feedbacker_development > #{dump_path}.sql"
  command "tar -zcvf #{dump_path}.tar.gz #{dump_path}.sql"
  command "rm #{dump_path}.sql"
  runner "Storage.store_dump '#{dump_path}.tar.gz'"
end

将其部署到我的服务器后,当前也在开发模式下运行,我使用了命令

whenever --update-crontab feedbacker --set environment=development

在此之后,我的crontab如下所示:

# Begin Whenever generated tasks for: feedbacker
30 2 * * * /bin/bash -l -c 'sudo mysqldump -uroot -prootz feedbacker_development > /User/eveadmin/rails/db_backups/dump2011-07-07.sql >> /User/eveadmin/rails/feebacker/log/cron_log.log 2>&1'

30 2 * * * /bin/bash -l -c 'tar -zcvf /User/eveadmin/rails/db_backups/dump2011-07-07.tar.gz /User/eveadmin/rails/db_backups/dump2011-07-07.sql >> /User/eveadmin/rails/feebacker/log/cron_log.log 2>&1'

30 2 * * * /bin/bash -l -c 'rm /User/eveadmin/rails/db_backups/dump2011-07-07.sql >> /User/eveadmin/rails/feebacker/log/cron_log.log 2>&1'

30 2 * * * /bin/bash -l -c 'cd /Users/thomasmaximini/Sites/rails_projekte/feedbacker && script/rails runner -e development '\''Storage.store_dump '\''\'\'''\''/User/eveadmin/rails/db_backups/dump2011-07-07.tar.gz'\''\'\'''\'''\'' >> /User/eveadmin/rails/feebacker/log/cron_log.log 2>&1'

# End Whenever generated tasks for: feedbacker

它什么都不做,没有生成cron.log,没有完成备份,什么也没做。所以我不知道我做错了什么因为调试没有出错。我希望有人能提供帮助,谢谢。

0 个答案:

没有答案