fixed some curl refs
This commit is contained in:
parent
436c6ead71
commit
c948ade688
1 changed files with 14 additions and 24 deletions
38
backup.ps1
38
backup.ps1
|
@ -2,6 +2,16 @@
|
||||||
|
|
||||||
$dir = Split-Path $script:MyInvocation.MyCommand.Path
|
$dir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||||
. "$dir/env.ps1"
|
. "$dir/env.ps1"
|
||||||
|
if ( $KUMA_ID -ne "" ){
|
||||||
|
$RUNNING_URL = https://$KUMA_URL/api/push/$KUMA_ID?status=up"&"msg=Running"&"ping=
|
||||||
|
$FAILURE_URL = https://$KUMA_URL/api/push/$KUMA_ID?status=down"&"msg=Failed"&"ping=
|
||||||
|
$SUCCESS_URL = https://$KUMA_URL/api/push/$KUMA_ID?status=up"&"msg=Completed"&"ping=
|
||||||
|
} else if ( $HEALTHCHECK_UUID -ne "" ) {
|
||||||
|
$RUNNING_URL = https://hc-ping.com/$HEALTHCHECK_UUID/start
|
||||||
|
$FAILURE_URL = https://hc-ping.com/$HEALTHCHECK_UUID/fail
|
||||||
|
$SUCCESS_URL = https://hc-ping.com/$HEALTHCHECK_UUID
|
||||||
|
}
|
||||||
|
Write-Host $URL
|
||||||
$DATE = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
|
$DATE = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
|
||||||
Write-Host "Backup $NAME at $DATE"
|
Write-Host "Backup $NAME at $DATE"
|
||||||
$BACKUP_CMD="restic backup $BACKUP_DIR"
|
$BACKUP_CMD="restic backup $BACKUP_DIR"
|
||||||
|
@ -16,21 +26,11 @@ $running = get-process | ?{$_.path -eq "C:\Windows\system32\restic.exe"}
|
||||||
Write-Host $running
|
Write-Host $running
|
||||||
if ( $running ) {
|
if ( $running ) {
|
||||||
Write-Host "Backup already running; $running. Exiting..."
|
Write-Host "Backup already running; $running. Exiting..."
|
||||||
if ( $KUMA_ID -ne "" ){
|
./bin/curl.exe $FAILURE_URL
|
||||||
./bin/curl.exe https://$KUMA_URL/api/push/$KUMA_ID?status=down"&"msg=Failed"&"ping=
|
|
||||||
}
|
|
||||||
if ( $HEALTHCHECK_UUID -ne "" ) {
|
|
||||||
./bin/curl.exe https://hc-ping.com/$HEALTHCHECK_UUID/fail
|
|
||||||
}
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
Write-Host "Not currently running. Continuing..."
|
Write-Host "Not currently running. Continuing..."
|
||||||
if ( $KUMA_ID -ne "" ){
|
./bin/curl.exe $RUNNING_URL
|
||||||
./bin/curl.exe https://$KUMA_URL/api/push/$KUMA_ID?status=up"&"msg=Running"&"ping=
|
|
||||||
}
|
|
||||||
if ( $HEALTHCHECK_UUID -ne "" ) {
|
|
||||||
./bin/curl.exe https://hc-ping.com/$HEALTHCHECK_UUID/start
|
|
||||||
}
|
|
||||||
if ( $PRE_RUN_SCRIPT ) {
|
if ( $PRE_RUN_SCRIPT ) {
|
||||||
. $dir/$PRE_RUN_SCRIPT
|
. $dir/$PRE_RUN_SCRIPT
|
||||||
}
|
}
|
||||||
|
@ -39,17 +39,7 @@ if ( $LastExitCode -eq 0 ) {
|
||||||
if ( $POST_RUN_SCRIPT ) {
|
if ( $POST_RUN_SCRIPT ) {
|
||||||
. $dir/$POST_RUN_SCRIPT
|
. $dir/$POST_RUN_SCRIPT
|
||||||
}
|
}
|
||||||
if ( $KUMA_ID -ne "" ){
|
./bin/curl.exe $SUCCESS_URL
|
||||||
./bin/curl.exe https://$KUMA_URL/api/push/$KUMA_ID?status=up"&"msg=Completed"&"ping=
|
|
||||||
}
|
|
||||||
if ( $HEALTHCHECK_UUID -ne "" ) {
|
|
||||||
./bin/curl.exe https://hc-ping.com/$HEALTHCHECK_UUID
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ( $KUMA_ID -ne "" ){
|
./bin/curl.exe $FAILURE_URL
|
||||||
./bin/curl.exe https://$KUMA_URL/api/push/$KUMA_ID?status=down"&"msg=Failed"&"ping=
|
|
||||||
}
|
|
||||||
if ( $HEALTHCHECK_UUID -ne "" ) {
|
|
||||||
./bin/curl.exe https://hc-ping.com/$HEALTHCHECK_UUID/fail
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue