Orbit/app/jobs/backup_server.rb

14 lines
426 B
Ruby
Raw Normal View History

class BackupServer
@queue = :high
def self.perform()
#CronMail.time_check("Going to backup Orbit").deliver
dbhost = Mongoid.config.database.connection.primary.join ':'
dbname = Mongoid.config.database.name
dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M")
%x[mongodump -h #{dbhost} -d #{dbname} -o #{dbdirectory} ]
# %x[touch #{Rails.root}/tmp/restart]
end
end