I have an bash script that will run db2 command (list active databases) and redirect the output to a file then I will use this file in another script.
Script:
/DB2RM1/db2rm1/sqllib/bin/db2 list active databases > /home/occddma/scripts/data
Note: I have put the location to the binaries of db2 before the db2 command to able to run it from crontab.
Then I put the script in crontab job to update datadb file every minute as shown below.
* * * * * /DB2RM1/db2rm1/mon_db2.sh
When I run the script form the command line it works fine but when it runs from the crotab job it redirects the below error to datadb file.
SQL10007N Message "-1390" could not be retrieved. Reason code: "3".