Hi there,
This is my first post, so as you have probably guessed I am looking for some help.
Currently we have close to 1000 ksh scripts operating on HPUX servers that call either isql or bcp to connect to Sybase databases. Problem being that the db passwords are appearing in the job log of the scheduler which calls these scripts. I have been asked to come up with a solution to modify these scripts to stop them outputting these passwords.
The version of isql we are using is
Sybase CTISQL Utility/12.5.1/P-EBF13182 ESD #12/DRV.12.5.1.4/hpux/HP-UX 11.11/BUILD1251-045/64bit/OPT/Thu Jan 12 20:44:52 2006
These scripts have been written by a plethora of different developers over the last 10-12 years, and the have set -o xtrace set at the beginning of the scripts to provide debugging information should one of these scripts fail. I have included a simple example of a typical script below, database user names and passwords are all stored as environmental parameters in env_params.ksh
#/usr/bin/ksh
. ./env_params.ksh
set -o xtrace
isql -S DBSERVER -D $DBNAME -U $DBUSER -P $DBPASSWORD <<-EOF
select * from Table
go
EOF
I know that having xtrace set is causing this to happen, but my remit requires that the same level of debugging information should be available after I make my change.
After trawling the web I cam across this possible solution, moving the password from the isql command
#/usr/bin/ksh
. ./env_params.ksh
set -o xtrace
...
...
...
isql -S DBSERVER -D $DBNAME -U $DBUSER <<-EOF
$DBPASSWORD
select * from Table
go
EOF
This works from an isql standpoint but it still outputs the password, as the $DBPASSWORD still has to be evaluated. If I hardcode the actual password in the script (obviously not an option) the password doesn't appear in the script output. The next solution I have come up with is the following which turns off xtrace while the isql command is being run, and setting it back on once the commands has completed.
#/usr/bin/ksh
. ./env_params.ksh
set -o xtrace
...
...
...
set +o xtrace
echo isql -S DBSERVER -D $DBNAME -U $DBUSER
isql -S DBSERVER -D $DBNAME -U $DBUSER <<-EOF
$DBPASSWORD
select * from Table
go
EOF
set -o xtrace
However it is a bit messy, and when you consider it has to be applied to nearly 1000 scripts, I am hoping that there maybe a simpler solution out there.
Thanks,
kdk