Class: MysqlBackup

Inherits:
DbBackup show all
Defined in:
lib/backup/mysql_backup.rb

Constant Summary

Constants inherited from Backup

Backup::DATE_FORMAT

Instance Attribute Summary

Attributes inherited from DbBackup

#database, #host, #password, #user

Attributes inherited from Backup

#dry_run, #quiet

Instance Method Summary collapse

Methods inherited from DbBackup

#filename, #initialize, #path, #restore_path

Methods inherited from Backup

#backup_type, #backup_type_filename, #clean_files, #compress?, #debug?, #encrypt?, #encrypt_compress_pipe_command, #ensure_path, #filename, #filename_extension, #filepath, #get_datetime_from_filename, #human_filesize, #initialize, #mark_file_to_delete, #minimum_backup_size, #output_command, #path, #process_clean_files, #run, #show_statistics, #verify_backup

Constructor Details

This class inherits a constructor from DbBackup

Instance Method Details

#backup_commandObject



8
9
10
# File 'lib/backup/mysql_backup.rb', line 8

def backup_command
  "mysqldump -C #{"--password='#{password}'" if password} #{"-h #{host}" if host} #{"--user=#{user}" if user} #{database}"
end

#db_listObject



12
13
14
# File 'lib/backup/mysql_backup.rb', line 12

def db_list
  @db_list ||= `mysql #{"--password='#{password}'" if password} #{"-h #{host}" if host} #{"--user=#{user}" if user} -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"`.split
end


4
5
6
# File 'lib/backup/mysql_backup.rb', line 4

def print_info
  puts "Run mysql backup on #{database} to #{filepath}..."
end