# Pastebin KfGDNsPc #!/bin/bash # Define database connection details DB_USER="musicbrainz" DB_PASSWORD="musicbrainz" DB_HOST="localhost" DB_PORT="5432" DB_NAME="musicbrainz_db" # Define tables to dump TABLES=( "area_alias_type" "area_alias" "area_type" "area" "area_gid_redirect" "area_annotation" "iso_3166_1" "iso_3166_2" "iso_3166_3" "l_area_area" "l_area_url" "link" "link_attribute" "link_attribute_type" "link_creditable_attribute_type" "link_attribute_credit" "link_text_attribute_type" "link_attribute_text_value" "link_type" "link_type_attribute_type" "url" "url_gid_redirect" ) # Output file OUTPUT_FILE="~/pg_area_dump.sql" # Construct the pg_dump command CMD="pg_dump postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}" for table in "${TABLES[@]}" do CMD="${CMD} -t ${table}" done CMD="${CMD} > ${OUTPUT_FILE}" # Execute the command eval "$CMD" # Check for errors if [ $? -eq 0 ]; then echo "Backup completed successfully." else echo "Backup failed." fi