Important: when calling OS commands from Domino servers in your integrations!
Daniel Nashed – 27 March 2022 09:21:22
Domino 12 Backup &Restore leverages OS commands for some of the integrations. This allows flexible integrations.But there might be other integrations you have implemented over time.
This week I discovered something, which can be important for your Domino integrations and also many other integrations!
I saw the odd behavior of Domino consoles but never put it into context.
When you launch a new task the output is written to STDOUT. And the error is written to STDERR.
You might have noticed this behavior earlier.
But the more critical part is STDIN which is also passed to the application. In my case to the batch or shell script.
On purpose I redirected STDERR to the file descriptor for STDOUT.
This allows me to caputure output when creating a new process via popen() https://linux.die.net/man/3/popen
What I missed is to also redirect the input for the shell script / batch.
Without a redirection the input (STDIN) is set to the file handle of the server!
This causes issues with the Domino server console! While the command is executed, you can't invoke any console commands.
All your input goes to the program or some other code on the server invoked!
So in my case I switched the invocation for Linux and Windows to the following type of command line.
For input I am using the platform null handle.
Linux
/restore_db.sh 2>&1 < /dev/null
Windows
c:\restore_db.cmd 2>&1 < NUL
A full command line would include also the output.
c:\restore_db.cmd > c:\temp\out.log 2>&1 < NUL
This is not only important for batch/shell scripts!
You should take care of it als for invoking any type of command.
Check https://en.wikipedia.org/wiki/Standard_streams for details about the streams.
- Comments [0]