update mysql_database_backup.rb
This commit is contained in:
parent
abe713024b
commit
4aad19d2bf
|
@ -58,13 +58,13 @@ class MysqlDatabaseBackup
|
||||||
existing_file = `b2-cli list-file-names #{@b2_bucket_name} --prefix #{b2_file_name}`
|
existing_file = `b2-cli list-file-names #{@b2_bucket_name} --prefix #{b2_file_name}`
|
||||||
if existing_file.include?(b2_file_name)
|
if existing_file.include?(b2_file_name)
|
||||||
# Delete the existing backup file from the B2 bucket
|
# Delete the existing backup file from the B2 bucket
|
||||||
file_version = existing_file.match(/"fileId": "([^"]+)"/)[1]
|
file_id = existing_file.match(/"fileId": "([^"]+)"/)[1]
|
||||||
`b2-cli delete-file-version #{@b2_bucket_name} #{b2_file_name} #{file_version}`
|
`b2 delete-file-version #{@b2_bucket_name} #{b2_file_name} #{file_id}`
|
||||||
puts "Deleted existing backup file from B2 bucket: #{b2_file_url}"
|
puts "Deleted existing backup file from B2 bucket: #{b2_file_url}"
|
||||||
end
|
end
|
||||||
# Upload the backup file to the B2 bucket
|
# Upload the backup file to the B2 bucket
|
||||||
|
|
||||||
`b2-cli upload-file #{@b2_bucket_name} #{backup_file} #{b2_file_name}`
|
`b2 upload-file #{@b2_bucket_name} #{backup_file} #{b2_file_name}`
|
||||||
puts "Uploaded backup file to B2 bucket: #{b2_file_url}"
|
puts "Uploaded backup file to B2 bucket: #{b2_file_url}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user