<% @read_cmd = 'crontab -l' @write_cmd = 'crontab -' @additive = ["# rubber-postgresql-start", "# rubber-postgresql-end"] %> <% # Backup db every 3 hours to secondary db if available, else primary db backup_db_host = rubber_instances.for_role('postgresql_slave').first rescue nil backup_db_host ||= rubber_instances.for_role('postgresql_master').first if backup_db_host.name == rubber_env.host %> 0 */3 * * * <%= Rubber.root %>/script/rubber cron --task util:backup_db --directory=/mnt/db_backups --dbuser=<%= rubber_env.db_user %> --dbpass=<%= rubber_env.db_pass %> --dbname=<%= rubber_env.db_name %> --dbhost=<%= backup_db_host.full_name %> <% end %>