X-Git-Url: https://git.p6c8.net/psmysqlbackup.git/blobdiff_plain/be998b79b9e8fe795075936b8e6819ead2f2b52a..c8443b63a6a7a513388cad85ff1651bfb0281b09:/psmysqlbackup.ps1?ds=sidebyside diff --git a/psmysqlbackup.ps1 b/psmysqlbackup.ps1 index 04ca03a..97bcf85 100644 --- a/psmysqlbackup.ps1 +++ b/psmysqlbackup.ps1 @@ -9,7 +9,8 @@ [String]$configBackupDir = "backup" [Int32]$configRotate = 7 -[String]$configDbExclusions = @("test") +$configDbBackup = @() +$configDbExclusions = @("test") $defaultExclusions = @("information_schema", "performance_schema") @@ -48,7 +49,16 @@ $currDaytime = Get-Date -format "yyyyMMdd-HHmmss" $databases = Get-Databases | Where-Object {!($_ -in $defaultExclusions -or $_ -in $configDbExclusions)} -foreach($d in $databases) { +$databasesToBackup = @() + +if($configDbBackup -and $configDbBackup.count -gt 0) { + $databasesToBackup = $configDbBackup +} +else { + $databasesToBackup = $databases +} + +foreach($d in $databasesToBackup) { $databaseBackupDir = Join-Path -Path $configBackupDir -ChildPath $d if(!(Test-Path $databaseBackupDir)) {