Project and Portfolio Management Practitioners Forum
cancel

Is there a way to prevent the output of a command from being displayed in the log?

SOLVED
Go to solution
Highlighted
djuncews
Valued Contributor.

Is there a way to prevent the output of a command from being displayed in the log?

I have sql script created using ksc_begin_script that connects to one Database grabs some data and then uses it to connect to another db.  When I worked for another company this script worked fine, but in this installation the following command in the script fails because the password is in encrypted.

 

connect [DEST_ENV.ENV.DB_USERNAME]/[DEST_ENV.ENV.DB_PASSWORD]@[DEST_ENV.DB_CONNECT_STRING]

translates to 

 

connect apps/#!#33tf WGXA}g7Sx1oz~3mYKt_~prjf1}acgQBhEKOx{wUX/$Tfz{9Y)roD5dIK::~W$eB(g.NY@H_Q-KO2ue}ba.e2&tnT<,64FDr^u*`iqAgrb)5RCsD^5G9.5KoqpYnsAAJpNstN^4/~&L|HC6.x7$iV>|RfrrOZ3c$M}:9)3O/7Z+7X{svKgIOEW~RI#!#@EBSDEV3

I found if I use the following when connected to  a server the password is not encrypted in the variable (which is good).

ksc_set V_PW="[DEST_ENV.ENV.DB_PASSWORD]"

 

Unfortunately when the command is executed it displays the password in the log file.

 

KSC Set

Source Command:Generate the Script File

V_PW=ABDC12345
Succeeded

 

I tried using 

ksc_set V_PW="[DEST_ENV.ENV.DB_PASSWORD]" >>/dev/nell and it fails with a paring error.

 

Does anybody know how to prevent this from being displayed inthe output file or prevent passwords that are passed into the KSC_BEGIN_SCRIPT from being encrypted?

 

Thanks for you help.

 

Dan

3 REPLIES
Utkarsh_Mishra
Acclaimed Contributor.

Re: Is there a way to prevent the output of a command from being displayed in the log?

There is hide option in ksc_simple_respond. You can use it is it fits in your requirement.

 

 

ksc_simple_respond "command" -hide "prompt 1" "response 1"["prompt 2" "response 2" … ]

Cheers..
Utkarsh Mishra

-- Remember to give Kudos to answers! (click the KUDOS star)
Mohit_Agrawal
Outstanding Contributor.

Re: Is there a way to prevent the output of a command from being displayed in the log?

Hi..

 

You can use KSC_SIMPLE_RESPOND as suggested above.

 

But we are not using that. What we do is:

 

##########

ksc_connect_dest_server
cd ./[P.P_SUB_PATH]

 

envfile=`echo .profile.[DEST_ENV.DB_ORACLE_SID] | tr '[A-Z]' '[a-z]'`
. /home/[DEST_ENV.ENV.SERVER_USERNAME]/$envfile

 

driver=driver_[PKG.ID]_[PKGL.SEQ].sql

 

sqlplus [DEST_ENV.APP="Oracle Database".DB_USERNAME]/[DEST_ENV.APP="Oracle Database".DB_PASSWORD]@[DEST_ENV.DB_CONNECT_STRING] @$driver

 

##########

 

And it works without shwoing the password for any DB user.

 

Regards,

Mohit

djuncews
Valued Contributor.
Solution

Re: Is there a way to prevent the output of a command from being displayed in the log?

I am connecting to two different databases.  One to start the script and one in the middle of the script.

 

I was able to get it to work using the driver=filename.sql.

 

I used echos and echoed the password into the file and it worked.  I did have to escape the special characters like quotes to appeara ppropriately.

 

Thank you for your help.