My questions seems identical to the question shown here but that question was unresolved. I’m trying to run a required script before a backup is run using –run-script-before-required; however, I receive the message:
The script “/config/test1.sh” returned with exit code 255
where test1.sh is:
env > /tmp/env.txt
as the response suggests in the reference question.
The path is accessible inside and outside the container. I can even run manually the script if I am inside the docker container without any problem.
Welcome to the forum!
Does the script actually work? Is the
/tmp/env.txt file generated with expected contents?
No, the file is not generated. In addition, I tried variations using different commands inside the test1.sh file. All result in the same error code. Here are my tests:
- touch /tmp/env.txt
- echo “hello”
You are using a docker container? Which image (official duplicati one, or linuxserver, or…)?
Can you open a shell inside the container and show the output of:
# ls -l /config/test1.sh
ls -l /config/test1.sh
-rwxr-xr-x 1 abc users 18 May 6 11:31 /config/test1.sh
I’m using the linuxserver docker container.
I did a quick test with the linuxserver duplicati image and it worked for me, BUT I didn’t do any volume redirections. Obviously in practice you’ll want to redirect /config to your host and maybe some other directories.
Did you redirect /tmp to your host, or is it still in the container? If redirected, maybe confirm the permissions and UID/GID mappings.
What is your process? I did the exact same thing and couldn’t get it to work. Also, I have gotten a separate permissions error that is resolved by allowing “others” to execute the file so I don’t understand how this could be a permission issue. Here’s my process:
docker run -d --name=‘duplicati’ --net=‘bridge’ -e TZ=“America/Chicago” -e HOST_OS=“Unraid” -e ‘PUID’=‘99’ -e ‘PGID’=‘100’ -p ‘8200:8200/tcp’ -v ‘/tmp’:’/tmp’:‘rw’ -v ‘/mnt/user/’:’/source’:‘rw’ -v ‘/mnt/user/appdata/duplicati’:’/config’:‘rw’ ‘linuxserver/duplicati’
- changing the PUID and PGID to 0 did nothing but I’m not sure those are the right settings
inside docker terminal run
echo 'echo "Hello, World!"' >> /home/test.sh
- /home is inside the container and not a mounted volume
inside docker terminal run
chmod a+x /home/test.sh
- to get around the permission denied issue
sh /home/test.sh prints “Hello, World!”
placing /home/test.sh in the –run-script-before-required Advanced Option in the GUI gives:
The script “/home/test.sh” returned with exit code 255
Oh, you don’t have this at the top of your script?
Maybe that’s why you’re having issues.
Ah! That was it! Rookie mistake, sorry. I’m not as used to not having even a command line text editor.
Tell me about it! Definitely an annoying aspect of the docker images…