added kuma url option

This commit is contained in:
Paul Wilde 2024-03-13 11:24:06 +00:00
parent 12ec6ff5e1
commit 3d063c4912
2 changed files with 29 additions and 5 deletions

View file

@ -15,11 +15,21 @@ $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 "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=down&msg=Failed&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail curl 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 "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=up&msg=Running&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID/start curl https://hc-ping.com/$HEALTHCHECK_UUID/start
}
if ( $PRE_RUN_SCRIPT ) { if ( $PRE_RUN_SCRIPT ) {
. $dir/$PRE_RUN_SCRIPT . $dir/$PRE_RUN_SCRIPT
} }
@ -28,7 +38,17 @@ if ( $LastExitCode -eq 0 ) {
if ( $POST_RUN_SCRIPT ) { if ( $POST_RUN_SCRIPT ) {
. $dir/$POST_RUN_SCRIPT . $dir/$POST_RUN_SCRIPT
} }
if ( $KUMA_ID -ne "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=up&msg=Completed&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID curl https://hc-ping.com/$HEALTHCHECK_UUID
}
} else { } else {
if ( $KUMA_ID -ne "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=down&msg=Failed&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail curl https://hc-ping.com/$HEALTHCHECK_UUID/fail
} }
}

View file

@ -8,6 +8,10 @@ $BACKUP_PARAMS=""
$BACKUP_EXCLUDE_FILE="" $BACKUP_EXCLUDE_FILE=""
# https://healthchecks.io uuid # https://healthchecks.io uuid
$HEALTHCHECK_UUID="" $HEALTHCHECK_UUID=""
# Uptime Kuma URL
$KUMA_URL=""
# Uptime Kuma push ID
$KUMA_ID=""
# name of a script to run before (ideally in the "pre/" dir) # name of a script to run before (ideally in the "pre/" dir)
$PRE_RUN_SCRIPT="" $PRE_RUN_SCRIPT=""
# name of a script to run after (ideally in the "post/" dir) # name of a script to run after (ideally in the "post/" dir)