Skip to content

Commit

Permalink
Option to backup all databases (#56)
Browse files Browse the repository at this point in the history
When DB_NAMES=* all non-system databases will be backuped
  • Loading branch information
samsk authored Oct 4, 2024
1 parent 331f651 commit 9ba1777
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ TARGETDIR="/backup"
# Remote backup directory
REMOTEDIR="/remote"

[ "$DB_NAMES" = "*" ] && DB_NAMES=`/opt/mssql-tools/bin/sqlcmd -S "$DB_SERVER" -U "$DB_USER" -P "$DB_PASSWORD" -b -h -1 -Q "SELECT name FROM sys.databases WHERE name NOT IN ('master', 'model', 'tempdb', 'msdb')" | awk '/^[a-z]/'`

for CURRENT_DB in $DB_NAMES
do

Expand Down

0 comments on commit 9ba1777

Please sign in to comment.