Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pasden
IT Invent
Commits
5bc15fdf
Commit
5bc15fdf
authored
Apr 05, 2021
by
pasden
💬
Browse files
Update backup_db.sh
parent
35829c0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/backup_db.sh
View file @
5bc15fdf
...
...
@@ -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!"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment