Duplicati and Telegram

Viewing the Duplicati Server Logs at About → Show log → Live → Warning might give some info. Technically the backup has already completed at script time, so the usual job log lacks script errors.

You could certainly do the echo-to-a-file test I’ve talked about several times. See how far script gets.
How quickly does the warning happen? There are lots of timeouts, but are you sure you got started?

How exactly? If you say bash <scriptname>, for example, it will work even if you forgot chmod +x.

I’m also still not hearing how you set up environment variables. Or does “everything works” mean with dummy settings like I used? One other issue I spotted in terms of working with Duplicati’s variables is:

The latter goes a step further than usual, because it adds an underscore inside PARSED_RESULT.

An issue I noticed with curl is that it tried writing its progress meter, which I didn’t really want in the scripted method (it makes more sense with a terminal), so I added --silent to the options for curl.

If you wonder how I saw what curl was writing, I used nc -l -p 8000, and had the curl script talk to it. Problem is that it wants a response to its POST. It can be typed in, but simpler test is to see POST:

$ nc -l -p 8000
POST /notify/ HTTP/1.1
Host: localhost:8000
User-Agent: curl/7.47.0
Accept: */*
Content-Type: application/json
Content-Length: 109

{"urls":"tgram://apikey", "body":"Success, Operation: Backup, Name: test2", "title":"Duplicati_Rancher_Home"}

Above was from a successful backup using the following script. Note I’m using localhost for the test.

$ ls -ln apprise.sh
-rwxr-xr-x 1 1000 1000 288 Apr  7 12:46 apprise.sh
$ cat apprise.sh
#!/bin/bash
curl --silent -X POST -d "{\"urls\":\"tgram://apikey\", \"body\":\"${DUPLICATI__PARSED_RESULT}, Operation: ${DUPLICATI__OPERATIONNAME}, Name: ${DUPLICATI__backup_name}\", \"title\":\"Duplicati_Rancher_Home\"}" -H "Content-Type: application/json" http://localhost:8000/notify/
$ 
1 Like