Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philecker/db-restore
📜 This is a shell script for simplifying a PostgreSQL database restore from backup file.
https://github.com/philecker/db-restore
postgresql shell shell-script shellscript
Last synced: 17 days ago
JSON representation
📜 This is a shell script for simplifying a PostgreSQL database restore from backup file.
- Host: GitHub
- URL: https://github.com/philecker/db-restore
- Owner: philecker
- License: mit
- Created: 2023-05-09T17:36:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-11T19:25:03.000Z (over 1 year ago)
- Last Synced: 2024-11-29T23:31:29.636Z (25 days ago)
- Topics: postgresql, shell, shell-script, shellscript
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Shell Script for Simplifying Database Restore from Backup File
This is a shell script that simplifies the process of restoring a PostgreSQL database from a backup file. The script expects the backup file to be located in the `~/Downloads/` directory.
### Usage
1. Save the script to a file with a `.sh` extension.
2. Open a terminal and navigate to the directory where the script is saved.
3. Make the script executable using the command `chmod +x scriptname.sh`.
4. Run the script using the command `./scriptname.sh`.
5. The script will drop and recreate the database using the default database name or the name you provide.
8. The script will prompt you to enter the backup file name or use the default file name.
9. The script will restore the database using the chosen or default backup file name.
10. Once the restore process is complete, the script will print a message indicating that the process is complete.Note: The script expects the backup file to be located in the `~/Downloads/` directory. If the backup file is not located in that directory, the script will fail to restore the database.
### Customization
You can customize the script by changing the default file name and database name. To do this, edit the following lines in the script:
```
defaultFileName="your_file_name_$today.backup"
defaultDatabase="your_database_name"
```Replace `your_file_name` with the name of your backup file and `your_database_name` with the name of your database.