X-Git-Url: https://git.p6c8.net/psmysqlbackup.git/blobdiff_plain/ac3854af1a50a24ad787fca5b3c250d7f8563e78..a463cecd9b193a49f93ac06c44ee3cdfa3d38128:/psmysqlbackup.ps1 diff --git a/psmysqlbackup.ps1 b/psmysqlbackup.ps1 index 9292ed4..1e23c5e 100644 --- a/psmysqlbackup.ps1 +++ b/psmysqlbackup.ps1 @@ -80,7 +80,14 @@ catch { $databasesToBackup = @() if($configDbBackup -and $configDbBackup.count -gt 0) { - $databasesToBackup = $configDbBackup + foreach($cDb in $configDbBackup) { + if($cDb -in $databases) { + $databasesToBackup += $cDb + } + else { + Write-Warning "Not backing up database $cDb, because it does not exist" + } + } } else { $databasesToBackup = $databases @@ -98,11 +105,10 @@ foreach($d in $databasesToBackup) { try { Create-Backup $d $databaseBackupFile + Rotate-Backups $databaseBackupDir } catch { Write-Output "Could not backup database $d to $databaseBackupFile" Write-Output $_ } - - Rotate-Backups $databaseBackupDir } \ No newline at end of file