DB Backup script

ludi

New Member
Hi everyone
Im trying to run the following script for my test project in OpenEdge 12.8 to backup my database before i can make it automated.

the file is saved as backup_script.sh
# Set the paths to your database and backup directory
DATABASE_DIR="C:\OpenEdge\DevOps\system\dba"
BACKUP_DIR="C:\OpenEdge\DevOps\system\backups"

# Define the names of your database and backup files
DATABASE_NAME="SportsERP"
FULL_BACKUP_FILE="$BACKUP_DIR/$DATABASE_NAME-$(date +'%Y-%m-%d').full"
TRANSACTION_LOG_BACKUP_FILE="$BACKUP_DIR/$DATABASE_NAME-$(date +'%Y-%m-%d_%H-%M').log"

# Print debug information
echo "Backup script starting..."
echo "Database directory: $DATABASE_DIR"
echo "Backup directory: $BACKUP_DIR"
echo "Full backup file: $FULL_BACKUP_FILE"
echo "Transaction log backup file: $TRANSACTION_LOG_BACKUP_FILE"

# Perform a full backup
echo "Performing full backup..."
proutil $DATABASE_DIR/$DATABASE_NAME -C backup $FULL_BACKUP_FILE

# Print debug information
echo "Full backup completed."

# Perform an hourly transaction log backup
echo "Performing transaction log backup..."
proutil $DATABASE_DIR/$DATABASE_NAME -C dumptlog $TRANSACTION_LOG_BACKUP_FILE

# Print debug information
echo "Transaction log backup completed."

In windows Powershell when i run the script, no backup file is being generated and its just asking me to open the backup_script.sh in any of the editors.
PS C:\OpenEdge\DevOps\system\dba\scripts>
PS C:\OpenEdge\DevOps\system\dba\scripts> ./backup_script.sh
PS C:\OpenEdge\DevOps\system\dba\scripts> ./backup_script.sh
PS C:\OpenEdge\DevOps\system\dba\scripts>
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Given both the syntax and the .sh extension, that is a Unix shell script. You would run that to back up a database on Linux.

You will need to translate it to the appropriate syntax for a scripting language on Windows, e.g. a batch file (.bat) or a Powershell script (.ps1).
 
Top