Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
ftwegner opened this issue Dec 27, 2021 · 1 comment
Open

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

ftwegner opened this issue Dec 27, 2021 · 1 comment

Comments

@ftwegner
Copy link

ftwegner commented Dec 27, 2021

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 ssh-user@111111111111.hostingkunde.de '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?

@niondir
Copy link
Member

niondir commented Jan 5, 2022

Having some documented "hooks" .sh scripts that are called optionally if linked or placed inside the container would be fine I guess.
It should not change the default behavior if someone do not want to use any hooks.

PR is welcome.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants