Method: #create_backup

Defined in:
lib/labdb_manager.rb

#create_backupObject

database commands



172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/labdb_manager.rb', line 172

def create_backup
  suffix = "_labdb_backup.dump"
  backup_timestring = Time.now.strftime("%Y%m%d_%H%M%S")
  fn = backup_timestring + suffix
  fn_full = File.expand_path(fn, DEFAULT_BACKUP_DIR)
  [PG_DUMP_PATH,
   "-h localhost labdb > #{fn_full}",
   "&&",
   "tar cjf #{fn_full}.tar.bz2 -C {DEFAULT_BACKUP_DIR} {fn}",
   "&&",
   "rm -f #{fn_full}"
   ].join(" ")
end