KenKundert/emborg

Add option to temporarily disable a backup

adhawkins opened this issue · 5 comments

I currently run my emborg jobs individually from a script, that does a 'create' and 'prune' for each job, and then emails the results of that individual job before moving on to the next one.

Sometimes I want to exclude some jobs from the backup run. Currently the only way I can do that is to move the file out of the config directory.

It would be helpful if each individual job's settings file had an entry along the lines of 'disable: false / true', which would just (say) print out a message saying 'This job is disabled' if certain operations (say create, check and prune) were run on it.

Would that be useful generally do you think?

Modifying the config files for individual runs is not really the intended use-model. Would it be easier to simply modify the script?

That's possible, but currently the script essentially does:

for backup in /root/.config/emborg/*
do
    (emborg -c $backup create; emborg -c $backup prune) | Mail me@mydomain.com -s "Borg backup for $backup"
done

Was looking for a way of disabling a particular backup for a while without having to move the settings file out of the directory.

The approach I would take would be to use the presence of a file to indicate that the backup is to be skipped. Something like:

for backup in /root/.config/emborg/*
do
    if [ -e ~/.config/emborg/$backup.skip ]
    then
        Mail me@mydomain.com -s "Borg backup for $backup SKIPPED" < /dev/null
    else
        (emborg -c $backup create; emborg -c $backup prune) | Mail me@mydomain.com -s "Borg backup for $backup"
    fi
done

Then to disable the home backup, you would simply create ~/.config/emborg/home.skip. So,

touch ~/.config/emborg/home.skip

to start skipping the backups, and

rm ~/.config/emborg/home.skip

to start backing it up again.

Yeah, that certainly one approach. I'll look into implementing that. Just thought the option might be worth doing. Obviously nobody else has asked for it!

I appreciate the suggestion. Some of my hesitation comes from the fact that is seems like kind of a dangerous option. My concern is that people will disable a backup and forget to re-enable it. Of course Emborg would probably emit a message saying that the backup is disabled, but such messages can get lost.