Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Send notifications via SSH to another desktop / notify-send (and more) #465

Closed
robincee opened this issue Sep 2, 2024 · 4 comments
Closed
Labels
enhancement New feature or request upstream

Comments

@robincee
Copy link

robincee commented Sep 2, 2024

Looking at the code & docs at https://offen.github.io/docker-volume-backup/how-tos/set-up-notifications.html and https://containrrr.dev/shoutrrr/v0.8/ i figured: Would it be an idea to implement support for notify-send over SSH? eg:

ssh user@host 'DISPLAY=:0 notify-send "Backup Success!"'

Could be something like this inside the compose.yml:

NOTIFICATION_SSH=ssh://user@host:port/?display=0&fromHost=example.com

Thank you folks for a great piece of work!

@m90
Copy link
Member

m90 commented Sep 2, 2024

I think it wouldn't make sense for this tool to add an additional way of sending notifications through other means than the library used, shoutrrr, so if a channel like notify-send is currently not supported by shoutrrr, the way to go would be to request its addition (or add it yourself) there and once merged, bump the library version here (which happens quite regularly, e.g. #212, #447)

@m90 m90 closed this as completed Sep 2, 2024
@m90 m90 added enhancement New feature or request upstream labels Sep 2, 2024
@m90
Copy link
Member

m90 commented Sep 2, 2024

In the meantime, you could probably also implement something similar using custom commands, as for example described here #159

@robincee
Copy link
Author

robincee commented Sep 2, 2024

Thank you for the information! Apologies: i discovered shoutrrr right after i posted this. Already figured the same. I'll do one better: i got working code now in Go (just started with Golang due to this lol, but looks doable), working on a patch for DVB, so i can patch my local version until / when / if ever shoutrrr accepts a (future) pr after i get into that code and figure out how to implement it there (lots to learn!) And i hope shoutrrr will accept it, cause SSH is 'something else'. + Totally understand what your are saying, fully agreed. TBC!

For now a simple bit like this seems to work great with openssh added via the Dockerfile.

    if s.c.SSHNotificationUrl != "" && s.c.SSHNotificationString != "" {
        cmd := exec.Command("ssh", fmt.Sprintf("%s", s.c.SSHNotificationUrl), fmt.Sprintf("%s", s.c.SSHNotificationString)+" 'Backups FAILED.'")
        cmd.Run()
    }

Thanks again!

@m90
Copy link
Member

m90 commented Sep 2, 2024

You wouldn't even need to patch the code for the image but could put the command you exec in a copy-post command on your backup container. See #159 and #297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request upstream
Projects
None yet
Development

No branches or pull requests

2 participants