Skip to content

Commit

Permalink
global vars
Browse files Browse the repository at this point in the history
  • Loading branch information
keithhubner committed May 7, 2024
1 parent 8317543 commit 0485fc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backup_script.sh
Expand Up @@ -21,6 +21,8 @@ trap 'err' ERR
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
LOG_TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")

LOGFILE="$APP_DIR/logs/backup-$TIMESTAMP.log"
BACKUP_FILE="$APP_DIR/backups/$DB_NAME-$TIMESTAMP.sql"

# Current date in seconds
CURRENT_DATE=$(date +%s)
Expand All @@ -32,14 +34,12 @@ function create_directorys() {
mkdir -p "$APP_DIR/logs"
echo "Backup directory created successfully."
# create log file
export LOGFILE="$APP_DIR/logs/backup-$TIMESTAMP.log"
touch "$LOGFILE" || { echo "Cannot write to $LOGFILE"; exit 1; }
echo "Log file: $LOGFILE"

}

function run_backup() {
export BACKUP_FILE="$APP_DIR/backups/$DB_NAME-$TIMESTAMP.sql"
echo "Backup file: $BACKUP_FILE"
echo "[$LOG_TIMESTAMP] Starting backup..."
echo "Running mysqldump..."
Expand Down

0 comments on commit 0485fc4

Please sign in to comment.