Send notification my server when computation is done

I am running a Julia computation on a server that takes days, but the exact amount of time is unpredictable in advance. I would like to be notified when the computation finishes, either correctly or with an error (so I could log in and debug). Ideally by e-mail, but other options are viable.

I can compile binaries on the server in my home directory.

E-mail used to be easy, with msmtp etc. But now most providers require OAUTH2 which is a PITA to set up.

I tried the glab client, thinking that because the project is managed on Gitlab and I work in branches, I could just do

glab mr note -m "hey your computation is done" 

and get an e-mail. But since it is created under my account, I am not notified.

Signal has a CLI client so I could DM myself. But then this would require authenticating with my full credentials on a server I do not control, so it is a last resort.

Any possibility I didn’t think of?

clarification the server does not have an MTA configured, or an MX domain.

1 Like

Do you have some other server you do control? If so, a simple HTTPS POST with Basic Authentication would be plenty, since those credentials are not very critical. On that server you can then also do some more elaborate email/signal/other messaging scheme for yourself.

1 Like

Maybe

as a Signal alternative - you could have a throwaway account for this?

2 Likes

Can you elaborate on how this works? Would this require that the web server (eg apache2) executes some command? How can I configure this?

If you have sendmail/postfix available on the server, something on the lines of :

function send_an_email(msgBody)
  message = """
          To: me@mydomain.org
          From: "My server" <no-reply@myserver.org>
          Subject: Debug email from running xyz


          $(msgBody)"""
  sendEmailCmd = pipeline(IOBuffer(message), `sendmail -t`)
  outcode =  run(sendEmailCmd).exitcode
end

The trick part is that most receiving email providers will now check if the IP of the server is authorized for sending emails in name of myserver.org, and this requires setting a TXT record on the DNS of myserver.org…

Sorry, I should have mentioned: no MTA is available. That would of course make the solution obvious.

In essence, yes. I don’t know if apache2 or nginx can do this out of the box, but if you already control the server, you can likely hook something up with HTTP.jl too, triggering the sending of some email or use the signal CLI from your secure server. I have not used it myself, but perhaps GitHub - binwiederhier/ntfy: Send push notifications to your phone or desktop using PUT/POST would work for you? You can also host that yourself.

It’s unfortunate how the web has evolved - this kind of stuff used to be much easier to do with things like Yahoo Pipes..

2 Likes

ntfy.sh works pretty well, im using it for a similar usecase. 0 setup - you can install an app on your phone or get notifications through a browser tab. i think cli might be possible as well. to send the notification is just a simple curl request. channels are public - there is no authentication or authorization.

ive used telegram in the past as well and its also pretty simple - essentially a oneliner if you use a library.

simplex has a commandline client and nostr as well and neither requires an “identity”.

if you strictly need mail, most providers let you make an app specific password.

if all else fails and you need mail to to an account you control, there are services like eg ifttt, zapier, GH actions and MS automate that can provide a webhook (url endpoint you can make requests to) that trigger emails

2 Likes

Thanks @Sukera and @slumpy, I tried ntfy.sh and it works great. I generated a 20-letter random string for the “topic”, which for this purpose I guess is as good as a password-protected channel.

2 Likes