diff --git a/.github/workflows/fac-backup-util.yml b/.github/workflows/fac-backup-util.yml index 47eed3246..da9de5fc4 100644 --- a/.github/workflows/fac-backup-util.yml +++ b/.github/workflows/fac-backup-util.yml @@ -25,6 +25,7 @@ on: options: - 'initial_backup' - 'deploy_backup' + - 'on_demand_backup' jobs: fac-backup: name: Perform Database Backup diff --git a/backend/fac-backup-util.sh b/backend/fac-backup-util.sh index 5804193ec..a149d8322 100755 --- a/backend/fac-backup-util.sh +++ b/backend/fac-backup-util.sh @@ -11,6 +11,7 @@ db_name="fac-db" backup_db_name="fac-snapshot-db" initial_date=$(date +%Y%m%d%H%M) scheduled_date=$(date +%m-%d-%H) +on_demand_date=$(date +%m-%d-%H) daily_date=$(date +%m-%d) mkdir tmp && cd tmp || return @@ -65,6 +66,18 @@ elif [ "$run_option" == "scheduled_backup" ]; then gonogo "db_to_s3" AWSS3Sync "$s3_name" "$backup_s3_name" gonogo "s3_sync" +elif [ "$run_option" == "on_demand_backup" ]; then + GetUtil + InstallAWS + gonogo "install_aws" + RowCount "$db_name" + gonogo "row_count" + RDSToS3Dump "$db_name" "$backup_s3_name" "on-demand/$on_demand_date" + gonogo "db_to_s3" + RDSToRDS "$db_name" "$backup_db_name" "backup" + gonogo "db_to_db" + AWSS3Sync "$s3_name" "$backup_s3_name" + gonogo "s3_sync" elif [ "$run_option" == "daily_backup" ]; then GetUtil InstallAWS