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
ThanksThis message has been edited. Last edited by: Tamra,
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
|Powered by Social Strata|