Before/After scripts Docker

Hello,
I am new with Duplicati and I want to use the before and after scripts. I am using the docker version linuxserver/duplicati:arm64v8-2.0.6 in a Raspberry Pi 4.

The scripts are like this both:

#!/bin/bash
exit 0

Duplicati is running as root inside the docker

root@duplicati:~# ps -ef | grep Duplicati
root         121     117  0 13:15 ?        00:00:01 mono Duplicati.Server.exe --webservice-interface=any --server-datafolder=/config --webservice-allowed-hostnames=*
root         127     121  0 13:15 ?        00:00:13 /usr/bin/mono-sgen /app/duplicati/Duplicati.Server.exe --webservice-interface=any --server-datafolder=/config --webservice-allowed-hostnames=*
root         231     156  0 13:49 pts/0    00:00:00 grep Duplicati

And the scripts have permission to execute:

root@duplicati:~# ls -ltr
total 72
drwxr-xr-x 2 root root  4096 Oct 20 13:15 control_dir_v2
-rwxr-xr-x 1 root root    19 Oct 20 13:17 after.sh
-rwxr-xr-x 1 root root    19 Oct 20 13:17 before.sh
-rw------- 1 root root 57344 Oct 20 13:22 Duplicati-server.sqlite

When the backup is executed the log shows this:

* 20 de oct. de 2022 13:22: Aborting operation by request, requested result: Error
* 20 de oct. de 2022 13:22: The script "/config/after.sh" returned with exit code 255
* 20 de oct. de 2022 13:22: The script "/config/before.sh" returned with exit code 255
* 20 de oct. de 2022 13:22: Error al cargar el montaje /app/duplicati/System.Threading.Overlapped.dll, mensaje de error: Invalid Image
* 20 de oct. de 2022 13:22: Error al cargar el montaje /app/duplicati/System.Globalization.Extensions.dll, mensaje de error: Invalid Image
* 20 de oct. de 2022 13:22: Error al cargar el montaje /app/duplicati/System.IO.Compression.dll, mensaje de error: Invalid Image
* 20 de oct. de 2022 13:22: Error al cargar el montaje /app/duplicati/System.Net.Http.dll, mensaje de error: Invalid Image

I will appreciate any asistance.

Probably a silly question, but it’s the only thing that came to mind - is this “ls -ltr” output from within /config?

@Lerrissirrel Yes, it is /config

root@duplicati:~# ls -ltr
total 72
drwxr-xr-x 2 root root  4096 Oct 20 13:15 control_dir_v2
-rwxr-xr-x 1 root root    19 Oct 20 13:17 after.sh
-rwxr-xr-x 1 root root    19 Oct 20 13:17 before.sh
-rw------- 1 root root 57344 Oct 20 13:22 Duplicati-server.sqlite
root@duplicati:~# pwd
/config

What happens if you run the scripts yourself from that bash session inside the docker container? After running, do this to see error code:

echo $?

I think I recall someone else having the problem (not sure if it was error code 255) but it was due to the script being in DOS format instead of unix (CR/LF issue).

2 Likes

@drwtsn32
OMG!! It was the Carrier Return!! I deleted all the CR from all lines and it worked!!

By the way, with the CRLF lines the result of the “echo $?” was correct.

# cat script.sh
#!/bin/bash
exit 0# sh script.sh
# echo $?
0
#

@Lerrissirrel @drwtsn32 Thank you very much for your help!!!

2 Likes