Skip to content

Create hook to run a script before notification email is sent #70

@ftwegner

Description

@ftwegner

I like to have a hook to insert a script which runs before a notification email is sent.

Motivation: I like to see the total space occupied by all restic snapshots on the target server. I need this, because my target server has a quota, and I like to make sure I do not exceed the quota with the backup snapshots. As a hack-y workaround I modified /bin/backup and inserted four lines before the notifications are generated when I do rclone backups via sftp:

logLast " "
logLast " "
logLast "Total size occupied by all restic snapshots:"
ssh -i /volume1/docker/privatekey.pem [email protected] 'du -h restic/ | tail -1' >> ${lastLogfile} 2>&1

This is for my web space at Domain Factory's ManagedHosting 64 Medium which contains ssh access. It has a 50 GB quota. The snapshots are in the sub-folder "restic/". The generated text in the email I get ends with:

Total size occupied by all restic snapshots:
8.4G	restic/

Of course, it would be much nicer and more sustainable to have this built in.
And maybe there is a much more elegant way to find out if I get close to exceeding the available space on the target medium?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions