Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn IB Bloggers
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [SOLVED]How to call a unix shell script in processs flow,capture script exit status
Go
New
Search
Notify
Tools
Reply
  
[SOLVED]How to call a unix shell script in processs flow,capture script exit status
 Login/Join
 
Member
posted
Hi

I have to run a Unix script from Data Migrator and capture the exit status of the execution of the script.

I tried solution provided in below old post

How to call a unix shell script in the process flow?

-SET &MYRETURN=SYSTEM(100,'ksh test.ksh,'D10');
-TYPE MYRETURN : &MYRETURN.

The &MYRETURN is always '0' even if script fails.

Is there a way to capture the exit code from Unix Script

Thanks

This message has been edited. Last edited by: Tamra,
 
Posts: 7 | Registered: August 05, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Example that uses echo to post a return code:

-* Create and execute a bash script command

-* preset the ruturn file with bad values
EX -LINES * EDAPUT TXT,bshrc,C,FILE
999
EDAPUT*
-RUN

-* build the script file
EX -LINES * EDAPUT TXT,bshscript,C,FILE
#!/usr/bin/ksh
touch /root/test 2> /dev/null
if [ $? -eq 0 ]
then
  echo 000 > bshrc.txt
  exit 0
else
  echo 001 > bshrc.txt
  exit 1
fi
EDAPUT*
-RUN
-* change script to executable
! chmod +x bshscript.txt
! ./bshscript.txt
-RUN

-* evaluate our returncode
-TYPE Showing bshrc
FILEDEF RTNCODE DISK bshrc.txt
-RUN
-READ RTNCODE &BSHRETURN.I3.
-TYPE Our Return Code: &BSHRETURN
-RUN  


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1023 | Location: Toronto, Ontario | Registered: May 26, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [SOLVED]How to call a unix shell script in processs flow,capture script exit status

Copyright © 1996-2017 Information Builders, leaders in enterprise business intelligence.