Sha256: 9c27a360cb0e3769fc27332b4afbc7f9f87310af0f7c9bbdabc7e914a318067e
Contents?: true
Size: 641 Bytes
Versions: 12
Compression:
Stored size: 641 Bytes
Contents
module BackupPlugins module Postgres def all_postgres limit = 500 # Check limit cluster_size_in_bytes = run_cmd('env psql postgres -c "SELECT sum(pg_database_size(pg_database.datname)) AS cluster_size FROM pg_database;"').match(/([0-9]{5,16})/).to_s.to_i raise "postgres limit reached limit:#{limit} cluster_size:#{cluster_size_in_bytes/1000/1000}" if cluster_size_in_bytes > limit * 1000 * 1000 puts run_cmd "mkdir -p #{backup_target_dir}/postgres" puts run_cmd "cd #{backup_target_dir}/postgres/; pg_dumpall > dumpall.pg.sql" puts "backup of postgres db on #{@server_domain}" end end end
Version data entries
12 entries across 12 versions & 1 rubygems