# PostgreSQL ## Introduction: Three scripts to: - Backup - Archive - Restore A running PostgreSQL installation (currently PostgreSQL 17) ## Files: * ### [backup_postgresql.sh] Backup the **whole** PostgreSQL application: * Remove the file showing that a previous backup was successful * Backup the whole of the PostgreSQL database installation * Create a file to show that the backup has successfully completed * ### [archive_postgresql_backup.sh] Archive the PostgreSQL application backup: * Remove the file showing that a previous archiving was successful * Archive the whole of the PostgreSQL database backup * Create a file to show that the archiving has successfully completed * ### [restore_postgresql.sh] Restore from a previously created backup: * Check to see if a backup has previously completed successfully * If a backup is in place then carry on and restore it * Stop the running PostgreSQL service * Show the current PostgreSQL status * chown the existing PostgreSQL installation * Remove the existing PostgreSQL files * Copy the latest backup to the PostgreSQL target location * Make the PostgreSQL user take ownership of the target location * Start the PostgreSQL service * Show the current PostgreSQL status