Tidy up
This commit is contained in:
@@ -7,7 +7,6 @@ $sqlInstance = "sqlfcsql\TESTINST"
|
|||||||
#$directory = "H:\Backup"
|
#$directory = "H:\Backup"
|
||||||
$directory = "C:\Rubrik\mount"
|
$directory = "C:\Rubrik\mount"
|
||||||
$fullBackupDay = 'Tuesday'
|
$fullBackupDay = 'Tuesday'
|
||||||
$cleanupTime = 24
|
|
||||||
$checkCluster = $false
|
$checkCluster = $false
|
||||||
|
|
||||||
$fullFlag = $directory + "\last_full.flag"
|
$fullFlag = $directory + "\last_full.flag"
|
||||||
@@ -54,6 +53,7 @@ if ($checkCluster) {
|
|||||||
if ((Get-Date).DayOfWeek -eq $fullBackupDay) {
|
if ((Get-Date).DayOfWeek -eq $fullBackupDay) {
|
||||||
if (-not (FlagTakenToday $fullFlag)) {
|
if (-not (FlagTakenToday $fullFlag)) {
|
||||||
$backupType = "FULL"
|
$backupType = "FULL"
|
||||||
|
$cleanupTime = 168
|
||||||
Set-Content $fullFlag $today.ToString("yyyy-MM-dd")
|
Set-Content $fullFlag $today.ToString("yyyy-MM-dd")
|
||||||
Write-Log "Selected FULL backup. Flag updated."
|
Write-Log "Selected FULL backup. Flag updated."
|
||||||
} else {
|
} else {
|
||||||
@@ -63,10 +63,12 @@ if ((Get-Date).DayOfWeek -eq $fullBackupDay) {
|
|||||||
} else {
|
} else {
|
||||||
if (-not (FlagTakenToday $diffFlag)) {
|
if (-not (FlagTakenToday $diffFlag)) {
|
||||||
$backupType = "DIFF"
|
$backupType = "DIFF"
|
||||||
|
$cleanupTime = 168
|
||||||
Set-Content $diffFlag $today.ToString("yyyy-MM-dd")
|
Set-Content $diffFlag $today.ToString("yyyy-MM-dd")
|
||||||
Write-Log "Selected DIFF backup. Flag updated."
|
Write-Log "Selected DIFF backup. Flag updated."
|
||||||
} else {
|
} else {
|
||||||
$backupType = "LOG"
|
$backupType = "LOG"
|
||||||
|
$cleanupTime = 24
|
||||||
Write-Log "DIFF backup already taken today. Selected LOG backup."
|
Write-Log "DIFF backup already taken today. Selected LOG backup."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
# a Global Service Account with the following rights (TBC)
|
# a Global Service Account with the following rights (TBC)
|
||||||
#
|
#
|
||||||
# Create the service account file with:
|
# Create the service account file with:
|
||||||
# Set-RscServiceAccountFile sa.json -OutputFilePath Global.xml
|
# Set-RscServiceAccountFile sa.json -OutputFilePath sa-rbksql.xml
|
||||||
#
|
#
|
||||||
# Example invocation
|
# Example invocation
|
||||||
# .\claimInstance.ps1 -sqlInstance "sqlfcsql\TESTINST" -mvName "JP-ZF-SQL"
|
# .\claimInstance.ps1 -sqlInstance "sqlfcsql\TESTINST" -mvName "JP-ZF-SQL"
|
||||||
@@ -29,7 +29,7 @@ param (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# SA File must be an absolute path
|
# SA File must be an absolute path
|
||||||
$GlobalSAFile = "C:\Rubrik\scripts\sa.xml"
|
$SAFile = "C:\Rubrik\scripts\sa-rbksql.xml"
|
||||||
$logFile = "C:\Rubrik\scripts\claimInstance.log"
|
$logFile = "C:\Rubrik\scripts\claimInstance.log"
|
||||||
$mvName = "JP-ZF-SQL"
|
$mvName = "JP-ZF-SQL"
|
||||||
$sqlInstance = "sqlfcsql\TESTINST"
|
$sqlInstance = "sqlfcsql\TESTINST"
|
||||||
@@ -61,7 +61,7 @@ if ($checkCluster) {
|
|||||||
if ($ownerNode -ne $localNode) {
|
if ($ownerNode -ne $localNode) {
|
||||||
Write-Log "SQL instance '$sqlInstance' is not running on local node '$localNode'. Updating the MV."
|
Write-Log "SQL instance '$sqlInstance' is not running on local node '$localNode'. Updating the MV."
|
||||||
|
|
||||||
Connect-Rsc -ServiceAccountFile $GlobalSAFile
|
Connect-Rsc -ServiceAccountFile $SAFile
|
||||||
Write-Log "Connected to Rubrik Security Cloud."
|
Write-Log "Connected to Rubrik Security Cloud."
|
||||||
|
|
||||||
$newHost = Get-RscHost -Name $ownerNode -OsType WINDOWS
|
$newHost = Get-RscHost -Name $ownerNode -OsType WINDOWS
|
||||||
@@ -118,4 +118,3 @@ if ($checkCluster) {
|
|||||||
Write-Log "INFO: Cluster check is disabled. Proceeding without verification."
|
Write-Log "INFO: Cluster check is disabled. Proceeding without verification."
|
||||||
}
|
}
|
||||||
|
|
||||||
Disconnect-Rsc
|
|
||||||
Reference in New Issue
Block a user