-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrestic_check.ps1
14 lines (11 loc) · 910 Bytes
/
restic_check.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<#
.Synopsis
Call restic check for the main script
.DESCRIPTION
This script will call restic check with defined parameters, send ping to HealthChecks, and log to $ResticLogCheck
#>
Write-Output ("`n`n=== STARTING CHECK ===`n") | Tee-Object -FilePath $ResticLogCheck -Append
Write-Output "Send start signal to HealthChecks ..."; Invoke-RestMethod -Uri ($HealthChecksCheckLink+"/start") -Method Post
& $ResticExecutable check --option rclone.program="'"$RcloneExecutable"'" --read-data-subset=$ResticCheckReadDataSubset *>&1 | Tee-Object -FilePath $ResticLogCheck -Append
# If failed, send signal, otherwise send success ; then send log
if(-not $?) { Write-Output "`nSend fail signal to HealthChecks ..."; Invoke-RestMethod -Uri ($HealthChecksCheckLink+"/fail") -Method Post } else {Write-Output "`nSend success signal to HealthChecks ..."; Invoke-RestMethod -Uri $HealthChecksCheckLink -Method Post}