Setup a --run-script-after in duplicati

Hi =) I try to setup a --run-after script to call apprise as a messege-microservice to notify about the backup. The script looks the following:

#!bin/bash
$(curl -X POST -d ‘{“urls”:“tgram://api/chatid/”,“body”:"$PARSEDRESULT",“title”:“Duplicati”}’ -H “Content-Type: application/json” http://apprise:8000/notify/)
exit 0

The script worls perfectly with docker exec scriptname bash, but when I run the backup, i get “1 Warning” but nothing is logged.

Can someone help? Does anyone managed to setup such a script?

Please post your docker run command/compose and please don’t set the PUID and PGID to root. We don’t support running our containers as root as it just leads to issues.

oh okay…but if I can’t set the container to root, I can’t fetch all data for backup…

version: '3.3'
services:
  duplicati:
    image: linuxserver/duplicati:latest
    environment:
      PGID: '0'
      PUID: '0'
      TZ: Europe/Vienna
    ports:
     - 8200:8200
    volumes:
     - duplicati_data:/config
     - somedir:/source
     - somedir:/backups
    networks:
     - apprise_notifier_net
     - net

Where is the script located? and where do you configure the script to run?

I tried it with a docker config mounted to root, and later I uploaded it to the /config folder where I made a folder called Scripts in run scripts after I set : /config/Scripts/scriptname

You have to explain in detail what you are doing. I can’t guess what you are doing.

Ok let’s assume the following situation:

  1. I setup the script:
#!bin/bash
$(curl -X POST -d ‘{“urls”:“tgram://api/chatid/”,“body”:"$PARSEDRESULT",“title”:“Duplicati”}’ -H “Content-Type: application/json” http://apprise:8000/notify/)
exit 0
  1. I upload the script in a folder that duplicati can access (for example /config/Scripts)
  2. I setup a duplicati-backup job, with the advanced option --run-script-after and /config/Scripts/scriptname
  3. I run the script
  4. I get the error

Tell me if you need more /other information…=)

That’s what my apprise-sidecar looks-like:

version: '3.3'
services:
  apprise:
    image: caronc/apprise:latest
    ports:
     - 8000:8000
    networks:
     - net
    logging:
      driver: json-file

And the error appears in dupliati?
The error is 1 warning?

yes but when i click on logs, it shows that everxything is allright…i don’t even get error message or something like that…

Can you turn on more verbose logging or debug logging in dupliati?
Might be something in your script that triggers the error. Can you make a simple script touching a file in /config and see if the same thing happens?

Your shebang is also wrong. You are missing / in front of bin

@saarg

thanks had a typo there =)

I tried it with the advanced option:

--console-log-level=Verbose

in the general advanced options, but still got nothing in logs…

[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

also not on frontend…everything is green there…except the yellow banner that leads to nowhere…

Have you checked in duplicati logs? Not the container logs.

@saarg
Huray I found a log =)

{"NativeErrorCode":5,"ClassName":"System.ComponentModel.Win32Exception","Message":"ApplicationName='/telegram_notification_duplicati', CommandLine='', CurrentDirectory='', Native error= Access denied","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":"  at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in <91935ad653254a93b9d73a9f8f2f7a2d>:0 \n  at System.Diagnostics.Process.Start () [0x0003a] in <91935ad653254a93b9d73a9f8f2f7a2d>:0 \n  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()\n  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001b] in <91935ad653254a93b9d73a9f8f2f7a2d>:0 \n  at Duplicati.Library.Modules.Builtin.RunScript.Execute (System.String scriptpath, System.String eventname, System.String operationname, System.String& remoteurl, System.String[]& localpath, System.Int32 timeout, System.Boolean requiredScript, System.Collections.Generic.IDictionary`2[TKey,TValue] options, System.String datafile, System.Nullable`1[T] level) [0x0015d] in <04c2b0910a9b45e2b6ef4f090eeb7063>:0 ","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467259,"Source":"System"}

Seems like a permission error…

same under config/

{"NativeErrorCode":5,"ClassName":"System.ComponentModel.Win32Exception","Message":"ApplicationName='/config/scripts/telegramnotification', CommandLine='', CurrentDirectory='', Native error= Access denied","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":"  at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in <91935ad653254a93b9d73a9f8f2f7a2d>:0 \n  at System.Diagnostics.Process.Start () [0x0003a] in <91935ad653254a93b9d73a9f8f2f7a2d>:0 \n  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()\n  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001b] in <91935ad653254a93b9d73a9f8f2f7a2d>:0 \n  at Duplicati.Library.Modules.Builtin.RunScript.Execute (System.String scriptpath, System.String eventname, System.String operationname, System.String& remoteurl, System.String[]& localpath, System.Int32 timeout, System.Boolean requiredScript, System.Collections.Generic.IDictionary`2[TKey,TValue] options, System.String datafile, System.Nullable`1[T] level) [0x0015d] in <04c2b0910a9b45e2b6ef4f090eeb7063>:0 ","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467259,"Source":"System"}

And what is the permissions on the scripts folder and the scripts?

root like the puid and gid of container

edit: just checked…the following permissions are there:

-rwxr-xr-x 1 root root

Probably caused by you running the container as root. Try running it as a normal user.

I got it working =) thanks for all the help and the effort =) I’ve posted a full how to here =):
https://forum.duplicati.com/t/duplicati-and-telegram/6282/19 @saarg thank you very much!!! =)