Valued Contributor.. SameetPatro Valued Contributor..
Valued Contributor..
434 views

Unable to generate the output file when executing shell scripts contains sql script

Jump to solution

Hi Team,

I need some help in shell script.

Attached is the shell script.

## get DB credentials #
feed=`
sqlplus -s $1/$2 <<-EOF>> ./DC_REP_LOG_FILES.txt
whenever sqlerror exit sql.sqlcode rollback;
SET SERVEROUTPUT ON;
SET VERIFY OFF;
SET FEEDBACK OFF;
SET HEADING OFF;
SET PAGESIZE 0;
select project_name from pm_projects where (creation_date >= TO_DATE(SUBSTR('$3',1,10),'YYYY-MM-DD') and creation_date < TO_DATE(SUBSTR('$4',1,10),'YYYY-MM-DD'));
exit;
EOF`

When i am calling this shell script in request type command the output is not getting generated  i.e. DC_REP_LOG_FILES.txt

What i did is :
1) I placed the sh file in PPM_HOME/bin directory
2) I created a special command which contaions the command i.e. ksc_local_exec sh bin/DC_REP_LOG_FILES.sh [AS.DB_USERNAME]@[AS.DB_CONNECTION_STRING] [AS.DB_PASSWORD] '[REQD.P.DC_START_DATE]' '[REQD.P.DC_END_DATE]'
3) In request type i used that special command
4) When i create the request -> the command gets executed but no output file i.e. DC_REP_LOG_FILES.txt is generated under PPM_HOME/bin directory.


Note:- When i execute the shell script manually under cygwin in PPM Server by passing hard code value the output file is getting generated.

Can any one please let me know what i am doing wrong or missing.

Thanks & Regards,
Sameet

0 Likes
1 Solution

Accepted Solutions
Outstanding Contributor.. Amishra Outstanding Contributor..
Outstanding Contributor..

Re: Unable to generate the output file when executing shell scripts contains sql script

Jump to solution

hi Sameet,

Have you tried spool instead?

Also i would recommend to not place anything under D:PPM/bin you can create a folder somewhere else and then place all your scripts under it. 

 

Regards,

Ajay

Regards,
Ajay Mishra
1 Reply
Outstanding Contributor.. Amishra Outstanding Contributor..
Outstanding Contributor..

Re: Unable to generate the output file when executing shell scripts contains sql script

Jump to solution

hi Sameet,

Have you tried spool instead?

Also i would recommend to not place anything under D:PPM/bin you can create a folder somewhere else and then place all your scripts under it. 

 

Regards,

Ajay

Regards,
Ajay Mishra
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.