Ping healthchecks.io when a check succeeds

I found one issue. I had added “&” in the name of my schedules. After removing “&” from the name, the stats of “Activities” & “New revisions” appeared again.

But there is still another issue. It still can’t see the latest stats for “storage size” + the “restore” page tells me there is no backup found.

If I make the Web UI use Duplicacy CLI (instead of my script), the “restore” page shows the backups.

If I make the Web UI use my script, the “restore” page doesn’t show the backups.

It is not a matter of name because when I put the version 0.0.0 in the name of Duplicy CLI, it still works. But as soon as I make the Web UI use my script, it doesn’t…

Any idea?

Try exec. Perhaps webgui communicates using pid of the spawned process.

If this resolves the issue — you would need to modify the scrip to spawn (with disown) another script to wait for current pid and then exec duplicacy to re-use pid; then there shall be no difference from the perspective of webui.

@saspus I’ve finally found the error! When I remove the first shift of my script before the while loop it all works! My understanding is that the first shift was removing the first argument?

So this is the script that works:

#!/bin/bash

script_dir="$(dirname "$(readlink -f "$0")")"

healthcheck_url=""
args=()

while [ $# -gt 0 ]; do
  if [ "$1" = "--healthcheck" ] && [ $# -gt 1 ]; then
    healthcheck_url="$2"
    shift 2
  else
    args+=("$1")
    shift
  fi
done

"$script_dir/duplicacy_linux_x64_3.2.3" "${args[@]}"

exit_code=$?

if [ -n "$healthcheck_url" ]; then
  curl -s "$healthcheck_url/$exit_code" > /dev/null || true
fi

exit $exit_code
1 Like

Interesting. Now that I think about it arguments don’t include the app name indeed as my example implied initially (unlike in C and similar languages)

But I thought you checked the arguments, because you mentioned you’ve checked the version and it was after checking arguments in the list :).

Glad it works now

No worries, you disclaimed you didn’t test! I learnt things too. And you helped me more than enough! Would have never been able to do this at all without your help :slight_smile:

Hopefully now you don’t see me again :joy: