Module: BackupPlugins::Mongo

Included in:
Keepitsafe
Defined in:
lib/plugins/mongo.rb

Instance Method Summary collapse

Instance Method Details

#all_mongo(limit = 30) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/plugins/mongo.rb', line 5

def all_mongo limit = 30

  # Check limit
  disk_usage_kb = (run_cmd "du /var/lib/mongodb/").match(/^([0-9]+)/).to_s.to_i

  raise "mongo limit reached limit:#{limit} disk_usage:#{disk_usage_kb/1000}" if disk_usage_kb > limit * 1000

  puts run_cmd "mkdir -p #{backup_target_dir}/mongo"

  puts run_cmd "cd #{backup_target_dir}/mongo/; mongodump --directoryperdb"

  puts "backup of mongo db on #{@server_domain}"
end