Help? run-script-before / after Duplicati Docker

I’m trying run a simple bash script that runs curl command to push notication to slack / rocketchat
I run the Linuxserver docker image of duplicati.
I placed the script.sh in /config of my mounted folder to the docker container.
I can run the script fine from there.
I can docker exec -it duplicati /bin/bash and run it from there as well no problems.
However I can NOT get to run in Duplicati app itself.
I am unable to discern any errors. I tried running via command line, the backup runs but the last line says error code 1.

I was trying to affirm how to set the script in duplicati.
/config/script.sh?
./config/script.sh?
. /config/script.sh?
. config/script.sh?

I did a chmod a+x and Ive tried root:root and the owner:group the other files are and as designated in the docker compose yml.
Via container bash it has said root:root and abc:abc

Any insight friends?

Hi @vulcanjedi, welcome to the forum!

I’m running Duplicati in a Docker container as well (I think it’s the LinuxServer one too) but honestly I’ve never tried using a script with it.

When you say running via command line says “error code 1” I assume you mean if you run the backup job from the command line you get an “error code 1” after the backup finishes?

Is it possible for you to post the actual terminal results (or GUI log entries) you’re getting?

Edit:
I did a quick test and found that if I place the script in /config/script.sh (which for me maps to /mnt/user/appdata/duplicati) and reference it in Duplicati as /config/script.sh I get the following warning in my Result report:

The script "/config/script.sh" returned with exit code 255\

If I purposefully mis-type the script as being /config/script-not-really.sh I get the following error:

Error while executing script "/config/scriptssss.sh": ApplicationName='/config/scriptssss.sh', CommandLine='', CurrentDirectory='', Native error= Cannot find the specified file => ApplicationName='/config/scriptssss.sh', CommandLine='', CurrentDirectory='', Native error= Cannot find the specified file

Can you try your 4 path options and see what warnings show up in the GUI Result for each path?

(By the way, I edited your post by adding ` (backwards apostrophe, usually with the ~ key) before and after your command line code to make it more obvious that it’s a command.)

Many thanks @JonMikelV;
I too am using the Linuxserver Duplicati image.
I created a test job.
I can run the script (i have also just made the script touch ./dummy.txt as well):
from the my ubuntu host
I can docker exec -it duplicati /bin/bash (and navigate to it and run it, it too is in /config which is mounted)
I can docker exec -u abc -it duplicati /bin/bash /config.script.sh
as well.

Currently not doing anything too crazy just want to run a curl command to send notice to Slack/RocketChat. Eventually may expand on it. But this seems far more difficult to just run a post process script for some strange reason.
When i input in the last tab of a backup job in Duplicati I have tried all the 4 paths to no avail. When I mean commandline I mean the command line option to run the job within the Duplicati web gui.
Running commandline entry
Finished!

Backup started at 4/18/2018 8:03:41 PM
Checking remote backup ...
  Listing remote folder ...
Scanning local files ...
  1 files need to be examined (817 bytes)
  0 files need to be examined (0 bytes)
removing temp files, as no data needs to be uploaded
Checking remote backup ...
  Listing remote folder ...
removing file listed as Temporary: duplicati-bf41a535eda494cc69d5b36a465d8bbed.dblock.zip.aes
removing file listed as Temporary: duplicati-if84db05387e54c2c8fa086833050f339.dindex.zip.aes
Verifying remote backup ...
Remote backup verification completed
  Downloading file (653 bytes) ...
  Downloading file (925 bytes) ...
  Downloading file (1.29 KB) ...
  Duration of backup: 00:00:00
  Remote files: 3
  Remote size: 2.83 KB
  Total remote quota: 221.26 GB
  Available remote quota: 163.80 GB
  Files added: 0
  Files deleted: 0
  Files changed: 0
  Data uploaded: 0 bytes
  Data downloaded: 2.83 KB
Backup completed successfully!
Return code: 1

Agreed. I have run pre and post scripts elsewhere without any major issues, but never in a Docker container so I’m pretty sure the issue is specific to that environment - I just don’t yet know how. :thinking:

I know the script reference is correct because I DON’T get the “Cannot find the specified file” error, however no matter what is in the script (even just an exit 1) I always get the “returned with exit code 255” warning.

I know a few other users (such as @lankanmon, @dgarsys, and possibly @Pectojin) have mentioned using Duplicati in a Docker container, perhaps one of them has used scripts there and might have a suggestion…

(Oh, and thanks for using the “`” around your commands! I updated your post with “~~~” around the log lines to make them stand out better.)

Thanks for the formatting tips. I’ll do better!
I just cant get wrapped around this, doesn’t seem like should be that difficult. I’ve searched and most references are all windows based. I saw the references to the environment variables and such but not a single thread on definitively how one is supposed to define a linux based deployment settings. I’ve never gotten anything but the Error Code:1

What strikes me as odder with all the linux wizards out there, no ones really done this or else no one else has issues?
Plus I use several other of the Linuxserver guys’ images. A couple I recently did add a script, and it runs in there just fine. Essentially the same script. There the pathing is /config/scriptname.sh and has argument fields.

With over 250k Linux runs last month I’m guessing it’s a combination of both.

I find it interesting that you always get Error Code:1 and I always get returned with exit code 255 - so we can’t even get matching results between our two tests of the same Docker container.

This could be due to a lot of different things including:

  • Duplicati version (I’m running 2.0.3.3 beta)
  • Docker host (I’m running unRAID 6.4.0)
  • mount point or share permissions, etc.

I’d love to figure this out with you if you have the time, though I’m not a Linux or Docker expert so I can’t promise we’ll get there quickly. But once we do we can make a How-To for others!

I assume these are other non-Duplicati containers, right?

I know there is now an official Duplicati container at Docker so I might try installing that just to see if it makes a difference.

I’m willing if you are @JonMikelV. I’m afraid I too am certainly far from a seasoned Linux nor Docker user.
I’m currently running about 22 containers via Docker Compose on Ubuntu 16 just updated few wks ago.

  • You are currently running Duplicati - 2.0.3.3_beta_2018-04-02
  • Ubuntu 16.04.4 LTS
  • Docker
  1. Server:
  2. Engine:
  3. Version: 18.03.0-ce
  4. API version: 1.37 (minimum version 1.12)
  • DockerCompose
  1. docker-compose version 1.18.0, build 8dd22a9
  2. docker-py version: 2.6.1
  3. CPython version: 2.7.13
  4. OpenSSL version: OpenSSL 1.0.1t 3 May 2016

One of the main things I love about Docker is it lets me try out stuff and then I can trash it if I don’t care for it.
Yes non Duplicati apps, I only have one Duplicati instance. Someone on a forum/wiki there cause they too allow post script processing. While there is native notification agents such as email/slack…etc The notifications themselves are NOT customizable in the app. But like Duplicati there is env variables so someone shared a script to just send the message load with the environment variables to a curl call to the slack webhook and it works fine.
I can’t even get this touch /config.txt command to work in Duplicati.
Personally I think this would be nice to help orchestrate other stuff like maintenance and other things. Say you want to back up some stuff running after a completed back up you could start other stuff back up or other various things post process scripts would be useful for aside from just notifications.

/docker/duplicati/config is mounted to /config
scripts have -rwxr-xr-x perms
via /bin/bash inside the container the script is owned by abc:abc
I have also tried root:root ownership
docker exec -u abc -it duplicati /bin/bash config/script.sh works which leads me to think not a ‘permissions’ issue?

PS OMG I just noticed the live preview pane in the posts here…apologize for having to sanitize my posts

My unRAID is based on Slackware so that might explain some of our result differences - though honestly my gut is telling me that’s not the case. Unfortunately my test Linux VM just blew up so I have to fix that before I can do a general Linux test of the same script to make sure it’s really a Docker environment issue like we suspect.

Heh - we all started out somewhere. :slight_smile:

I’m also facing the same issue with docker container. Anybody found a solution, please post?

Hi @youhoome, welcome to the forum!

Are you using the LinuxServer (linuxserver/duplicati) container or the Github (duplicati/duplicati) one?

One thing I noticed (but haven’t followed up on) recently is that my config folder seems to change locations with container updates. I don’t know if that would have an effect on trying to run the scripts, but it’s possible…

First I started using Linuxserver/duplicati after facing this issue stumbled upon duplicati/duplicati image, still same problem continues with official one as well. But I made sure I deleted all the old volumes and used a different name before trying duplicati/duplicati. Any help would be really helpful.

OK - I got a script working so here we go. :slight_smile:

My setup is:

  • Using the duplicati/duplicati Docker image
  • Volume mapping (app to host) includes /config <-> /mnt/user/appdata/duplicati

I placed the following script (marked as executable) in /mnt/user/appdata/duplicati

#!/bin/sh
exit 2

I then set --run-script-before-required=/config/script.sh (remember, /config/ in the container maps to /mnt/user/appdata/duplicati on the drive).

Running the job like this fails AS IT SHOULD with The script "/config/script.sh" returned with exit code 2.

If I change the script to end with exit 1 and run the job again, it fails AS IT SHOULD with The script "/config/script.sh" returned with exit code 1.

But if I change the script to end with exit 0 and run the job again, it runs as expected.

Can you (or @vulcanjedi) replicate this to confirm it works for more than just me?

Sorry for delay…
I think this is working for me, Im using healthchecks and it seems like the outbound ping went off. I need to try to get a slack notification working.
Thanks!

Did someone get it working with linuxserver/duplicati or rather duplicati/duplicati? Is it an image specific issue?