Commit 5bc15fdf authored by pasden's avatar pasden 💬
Browse files

Update backup_db.sh

parent 35829c0c
......@@ -10,6 +10,7 @@ SQL_PORT="1433"
CONTAINER_DATA_PATH="${PATH_DOCKER_CONTAINERS}/${CONTAINER_NAME}"
echo "--"
docker exec -t $CONTAINER_NAME /opt/mssql-tools/bin/sqlcmd \
-S "localhost,${SQL_PORT}" \
-U "${SQL_USER}" \
......@@ -27,5 +28,5 @@ RESTORE VERIFYONLY FROM DISK = @fullPathBackupFile WITH FILE = @backupSetId, NOU
" \
-o "${BACKUP_PATH_INSIDE_CONTAINER}/backup_${SQL_DATABASE}_$(date +'%Y-%m-%d_%H-%M-%S').log"
find ${CONTAINER_DATA_PATH}/backup -type f -name "*.log" -mmin +480 -exec rm -f {} \;
find ${CONTAINER_DATA_PATH}/backup -type f -name "*.bak" -mmin +480 -exec rm -f {} \;
find ${CONTAINER_DATA_PATH}/backup -type f -name "*.log" -mmin +480 -exec rm -f {} \; && echo "remove old .log files!"
find ${CONTAINER_DATA_PATH}/backup -type f -name "*.bak" -mmin +480 -exec rm -f {} \; && echo "remove old .bak files!"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment