Wondering a few things regarding scripting in duplicati:
- Where does the --run-script-[before|after] stdout output go to (is there a difference)?
- Why is output written to stderr in the BEFORE event shown after the backup as warning, but errors written during AFTER don’t show up?
Recently adopted duplicati and very happy with it so far.
I’m still tailoring it to my needs, which the --run-script-before and --run-script-after switches are perfect for.
More specifically I’m working on a script that makes sure that my docker environment is in a consistent state (off, for most containers) before backing up their databases and data. No issues there, it all works well.
Now one thing I don’t really understand, nor was able to found explained somewhere, is where exactly does output go to when echoed to stdout?
Upon creating the initial versions of the script I noticed the echo commands (used to see/log what was going on) seemed to “vanish”, so therefore I’ve created a simple function write_log that checks an environment variable for value TRUE, and if it is, it’ll write debug information into a file in the /tmp dir. When I call the function with “ERROR” behind it, it’ll also write the same line into the stderr stream, so that it shows up in the final log as a warning (which is does, but only while running the BEFORE event, the AFTER errors don’t show up in any log).
I have several steps in my AFTER sequence, that aims to start docker and also checks if the number of docker containers running is the same as before the backup, but I’m wondering how to get the log to show any errors, I know I can just exit with 4 and have an exit thrown, but it doesn’t give me any details on the error I’ve outputted into stderr during the AFTER event which will be confusing if something will fail in the future.
Note that I’m aware I can have duplicati just mail the loglines and have the same information, but I’d like to understand what is going on here
When I’ve sorted this out I’ll expand my work to include mailing.
- Docker image duplicati/duplicati (DUPLICATI_VERSION=220.127.116.11_beta_2020-01-18)
- unRAID (slackware based) host
- Docker CE version 19.03.5
I appreciate any efforts taken to read and answer