I have a script I've setup to run a number of tasks, one of which is to set up a table in a DB and later remove it (for automated testing).
The issue comes that on only a few of the users that I use the su - user -c
command, the call to db2 fails. The odd thing however, is that using su - user
and then running the db2 command works fine (outside of the script). This only happens after I have run the script once and during the script running process (though there's nothing I can see that would cause it to somehow change anything, sadly I can't share the exact code, though I could share an example/recreation of it if it would help), which merely contains a few basic loops, and a bunch of su - user -c
commands calling IBM mq commands.
For example this fails:
su - user -c "db2 connect to database USER user USING pass; db2 'CREATE TABLE LETABLE (LEFIELD VARCHAR (16))'"
Error:
DB21016E The Command Line Processor encountered a system error while sending the command to the backend process.
DB21018E A system error occurred. The command line processor could not continue processing.
However this works fine:
su - user
db2 connect to database USER user USING pass
db2 'CREATE TABLE LETABLE (LEFIELD VARCHAR (16))'
I've tried outputting the env command in both cases, to see if there's somehow something different, but they match as would be expected. I've also tried adjusting the order the different users run in, but that doesn't seem to help either.
I am truly confused and any help would be greatly appreciated.
I am using a ksh shell.