# Monitor restic backups with HookPulse check-ins

A small script runs restic backup and forget, then sends the exit status of the last step to HookPulse.

HookPulse · Updated 2026-10-14

## Step 1. Create the monitor

Add a routine named restic-backup and set how often the job runs. Its page shows the check-in URL: use it in place of https://hookpulse.net/in/YOUR_ID.

## Step 2. Write the backup script

The && runs forget only after a good backup. $? is the status of the last command that ran, so a failed backup or a failed prune is reported.

```sh
#!/bin/sh
# /usr/local/bin/restic-backup.sh
export RESTIC_REPOSITORY=/srv/restic-repo
export RESTIC_PASSWORD_FILE=/root/.restic-password
restic backup /srv/data --quiet && restic forget --keep-daily 7 --keep-weekly 4 --prune --quiet
curl -fsS -m 10 --retry 3 "https://hookpulse.net/in/YOUR_ID/$?"
```

## Step 3. Schedule the script

Make it executable with chmod +x, then add this line to the crontab.

```sh
0 3 * * * /usr/local/bin/restic-backup.sh
```

## Step 4. Run it once

Run the script once. The routine shows the first check-in. From then on, a missed or failed run sends the alert.

[Create the monitor](https://hookpulse.net/?routine=restic-backup&every=86400#routines)

[Monitor restic backups with HookPulse check-ins](https://hookpulse.net/guides/restic)
