← All guides

Guide · Backups

Monitor Duplicati backups

Duplicati's own notifications only fire if Duplicati itself is still running. If the scheduler dies, the machine is off, or the job gets silently disabled, nobody hears about it. A check-in from Duplicati's built-in run-script-after hook proves every backup actually finished, and pings /fail the moment one doesn't.

1. Create a check

Create a check in Mortemain with the same schedule as your backup job, plus a grace window for slow runs, then copy its ping URL.

2. Point Duplicati at a script after the job

Open the backup in the Duplicati web UI, go to Options → Advanced options, click Edit as text, and add:

 advanced options
--run-script-after=/etc/duplicati/duplicati-ping.sh

The same option works unattended on the command line:

 duplicati-cli
duplicati-cli backup "file:///backups/target" /home/user/data --run-script-after=/etc/duplicati/duplicati-ping.sh

Make the script executable once, or Duplicati won't be able to run it:

 shell
chmod +x /etc/duplicati/duplicati-ping.sh

3. Read the result and ping

Duplicati passes the outcome of the run to the script as the DUPLICATI__PARSED_RESULT environment variable, one of Success, Warning, Error or Fatal. Treat Success and Warning as a completed backup, and ping /fail on anything else:

 duplicati-ping.sh
#!/bin/sh
# set as --run-script-after in Duplicati
URL="https://ping.mortemain.com/your-check-uuid"

case "$DUPLICATI__PARSED_RESULT" in
  Success|Warning)
    curl -fsS -m 10 "$URL" ;;
  *)
    curl -fsS -m 10 "$URL/fail" ;;
esac

Running Duplicati on Windows? Use a .bat or PowerShell script instead: Duplicati sets the same DUPLICATI__* environment variables either way.

4. Optional: catch a hung backup, not just a failed one

A backup that never finishes doesn't trigger run-script-after at all. Add a matching --run-script-before that pings /start when the run begins, then Mortemain also alerts if a started backup never checks in:

 duplicati-start.sh
#!/bin/sh
curl -fsS -m 10 "https://ping.mortemain.com/your-check-uuid/start"
 advanced options
--run-script-before=/etc/duplicati/duplicati-start.sh
--run-script-after=/etc/duplicati/duplicati-ping.sh

Test it

Click Run now on the backup, the check flips to up once the script fires. Then rename the destination folder so the next run fails, and confirm the alert lands immediately, that's the failure mode Duplicati's own email notifications can miss if the scheduler itself stops.