git.p6c8.net
/
psmysqlbackup.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
452a65f
)
Catch exception when creating a directory for a database backup
0.1
author
Patrick Canterino
<patrick@patrick-canterino.de>
Sat, 1 Jan 2022 16:41:46 +0000
(17:41 +0100)
committer
Patrick Canterino
<patrick@patrick-canterino.de>
Sat, 1 Jan 2022 16:41:46 +0000
(17:41 +0100)
psmysqlbackup.ps1
patch
|
blob
|
history
diff --git
a/psmysqlbackup.ps1
b/psmysqlbackup.ps1
index 03d63ea12cdc611ba77431a07f1b3d220da285ea..f544cca7efeb2a738ea8692da91147a7edeb04b5 100644
(file)
--- a/
psmysqlbackup.ps1
+++ b/
psmysqlbackup.ps1
@@
-111,7
+111,14
@@
foreach($d in $databasesToBackup) {
$databaseBackupDir = Join-Path -Path $configBackupDir -ChildPath $d
if(!(Test-Path $databaseBackupDir)) {
$databaseBackupDir = Join-Path -Path $configBackupDir -ChildPath $d
if(!(Test-Path $databaseBackupDir)) {
- New-Item -ItemType directory -Path $databaseBackupDir -ErrorAction Stop | Out-Null
+ try {
+ New-Item -ItemType directory -Path "$databaseBackupDir" -ErrorAction Stop | Out-Null
+ }
+ catch {
+ Write-Output "Failed to create directory $databaseBackupDir"
+ Write-Output $_
+ exit 1
+ }
}
$databaseBackupFile = Join-Path -Path $databaseBackupDir -ChildPath "backup-$d-$currDaytime.sql"
}
$databaseBackupFile = Join-Path -Path $databaseBackupDir -ChildPath "backup-$d-$currDaytime.sql"
patrick-canterino.de