#!/bin/bash# Define the PostgreSQL credentials and backup file informationPGUSER=""PGHOST=""PGPORT=""PGDATABASE=""# Generate a timestamp in the format yyyy-mm-dd-hh-mmTIMESTAMP=$(date +"%Y-%m-%d-%H-%M")# Define the backup file name with the timestampBACKUP_FILENAME="backup_$TIMESTAMP.tar"# Prompt for the database passwordecho "Please enter the PostgreSQL password:"read -s PGPASSWORD# Export the password to be used by pg_dumpexport PGPASSWORD# Execute the pg_dump commandpg_dump -U $PGUSER -h $PGHOST -p $PGPORT -W -F t $PGDATABASE > $BACKUP_FILENAME# Unset the password for security reasonsunset PGPASSWORDecho "Backup completed successfully."