Created
August 19, 2023 11:35
-
-
Save dsifat/18727ac4646e975a537598a2507399d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the database name and the backup file name | |
DB_NAME="database" | |
BACKUP_FILE="database_backup.sql" | |
date=date=$(date '+%Y-%m-%d') | |
# Set the username and password for the database | |
DB_USERNAME="username" | |
DB_PASSWORD="password" | |
# Dump the database to a file | |
pg_dump -U $DB_USERNAME -W $DB_NAME > $BACKUP_FILE_${date} | |
echo "Database has been done on ${date}" >> /tmp/backup_log_${date}.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment