I'm not sure if this is a bug or if I'm just not understanding the run- options.
I would like to backup my laptop to an external USB hard drive daily. I don't always have the drive plugged into the laptop, so if it's not plugged in, it should just skip it that day.
If the drive is plugged in and restic attempts to backup but fails, it should ping a server which emails me about the failure. The ping shouldn't happen if the drive is not plugged in.
Here is a minimal example of my config, where I replaced the ping with an echo.
version: "2"
profiles:
edrive:
password-file: "password.txt"
repository: "/media/drive/backup/"
run-before: "mountpoint -q /media/drive || exit 1"
backup:
source:
- "/home"
run-after-fail: 'echo "BACKUP FAIL, SEND PING TO SERVER"'
This is the terminal input/output if the drive is not plugged in.
$ resticprofile edrive.backup
2026/06/17 16:14:48 using configuration file: /home/user/.config/resticprofile/profiles.yaml
BACKUP FAIL, SEND PING TO SERVER
2026/06/17 16:08:58 run-before on profile 'edrive': exit status 1
My expectation would be that if the run-before in the profile fails, then the backup block, including the run-after-fail within it, should not run at all.
I'm not sure if this is a bug or if I'm just not understanding the run- options.
I would like to backup my laptop to an external USB hard drive daily. I don't always have the drive plugged into the laptop, so if it's not plugged in, it should just skip it that day.
If the drive is plugged in and restic attempts to backup but fails, it should ping a server which emails me about the failure. The ping shouldn't happen if the drive is not plugged in.
Here is a minimal example of my config, where I replaced the ping with an echo.
This is the terminal input/output if the drive is not plugged in.
My expectation would be that if the
run-beforein the profile fails, then thebackupblock, including therun-after-failwithin it, should not run at all.