Skip to content

Commit

Permalink
hope this works
Browse files Browse the repository at this point in the history
  • Loading branch information
keithhubner committed May 2, 2024
1 parent 16f9214 commit dcd6368
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backup_script.sh
Expand Up @@ -20,8 +20,7 @@ trap 'err' ERR

TIMESTAMP=$(date +"%Y%m%d%H%M%S")
LOG_TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
BACKUP_FILE="$APP_DIR/backups/$DB_NAME-$TIMESTAMP.sql"
echo "Backup file: $BACKUP_FILE"


# Current date in seconds
CURRENT_DATE=$(date +%s)
Expand All @@ -37,6 +36,12 @@ function create_directorys() {
echo "Log file: $LOGFILE"
}

function create_log_file() {
echo "Creating log file..."
LOGFILE="$APP_DIR/logs/backup-$TIMESTAMP.log"
echo "Log file: $LOGFILE"
}

function run_backup() {
echo "[$LOG_TIMESTAMP] Starting backup..."
echo "Running mysqldump..."
Expand Down Expand Up @@ -77,12 +82,13 @@ function cleanup() {

function main() {
create_directorys
create_log_file
run_backup
run_s3_backup
cleanup
}

main 2>&1 | tee -a ${LOGFILE} # watch the log file for errors
main 2>&1 | tee -a $LOGFILE # watch the log file for errors



Expand Down

0 comments on commit dcd6368

Please sign in to comment.