Exit code 267 from shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Exit code 267 from shell script
# 1  
Old 03-09-2018
Exit code 267 from shell script

Hi,

We have a problem in Linux (GNU/Linux 3.10.0-693.1.1.el7.x86_64) with a shell script returning 267 as return code. The script, load_flag.sh is called from main_script.sh (both script samples given below). The exit code from load_flag.sh is used to decide whether to continue execution of main_script.sh. Exit code is sometimes coming as 267 and main_script.sh is not executing. This issue is not happening in every run, but sporadically. Any idea, why we are getting the exit code as 267 and the possibel solution for this.


Code:
#main_script.sh
#!/bin/ksh
##### run the environment setup script
. /path/setup.sh

##LOADER_HOME and other variables are set in setup.sh

$LOADERS_HOME/load_flag.sh ABC
LOAD_FLAG_ABC=$?

if [ ! $LOAD_FLAG_ABC = 0 ]
then
   echo `date `' LOAD_FLAG_ABC: ' $LOAD_FLAG_ABC 
   exit 0
fi
....
<<script continues>>
....
....
....



Code:
#load_flag.sh
#!/bin/ksh
SYSTEM_NAME=$1

#############################################################
##### Obtain loading flags from database
#############################################################

DBCONNECTION=$DBUSER@$DBSERVER/$DBPASS
LOAD_FLAG=`$ORACLE_HOME/bin/sqlplus <<+ | grep '^-' | sed 's/-//'
\$DBCONNECTION
SET SERVEROUTPUT ON FORMAT WRAPPED
SET PAGESIZE 0
SET FEEDBACK OFF
DECLARE
    L_STATUS VARCHAR2(100);
    L_SYSTEM VARCHAR2(100);
BEGIN
    L_SYSTEM := '\${SYSTEM_NAME}';
    L_STATUS := SCHEMA.PACKAGE.FUNCTION(L_SYSTEM);
    DBMS_OUTPUT.PUT_LINE(CHR(10) || '-' || L_STATUS);
EXCEPTION WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(CHR(10) || '-' || SQLCODE || ':' || SQLERRM);
END;
/
exit
+`

echo FLAG FOR $1: $LOAD_FLAG

if [ $LOAD_FLAG = 0 ]
then
  exit 0
fi

exit 1


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-09-2018 at 10:40 AM.. Reason: Added CODE tags.
# 2  
Old 03-09-2018
man ksh:
Quote:
Commands.
... exit status; 0-255 if it terminates normally; 256+signum if it terminates abnormally ...
kill -l:
Code:
.
.
.
11) SIGSEGV    . . .

From /stackoverflow.com/questions/tagged/sigsegv:
Quote:
On POSIX-compliant platforms, SIGSEGV is the signal sent to a process when it makes an invalid memory reference, or segmentation fault.
Not sure, how mature your DB query is, or how much output it gernerates. Is the error system load dependent?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Exit the shell script

Hi, suppose my script is sample.sh i have to run using '. ./sample.sh' as . ./script file always executes the script in my parent shell. when my sample.sh contains exit command .. my environment is getting closed as am executing in the parent shell ... please suggest me how can i use... (5 Replies)
Discussion started by: pracheth
5 Replies

2. Shell Programming and Scripting

How to capture the exit code of a shell script in a perl script.?

hi, i want to pop up an alert box using perl script. my requirement is. i am using a html page which calls a perl script. this perl script calls a shell script.. after the shell script ends its execution, i am using exit 0 to terminate the shell script successfully and exit 1 to terminate the... (3 Replies)
Discussion started by: Little
3 Replies

3. Shell Programming and Scripting

Exit a shell script

Hi Guys, How can I exit from the shell script if a condition is not met? Thanks in advance... (2 Replies)
Discussion started by: Phuti
2 Replies

4. Shell Programming and Scripting

How to capture exit code of child script and send it to parent script?

#!/usr/local/bin/bash set -vx /prod/HotelierLinks/palaceLink/bin/PalacefilesWait /prod/HotelierLinks/palaceLink/bin/prodEnvSetup 03212013 & if then echo "fatal error: Palace/HardRock failed!!!!" 1>&2 echo "Palace Failed" | mail -s "Link Failed at Palace/HardRock" -c... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies

5. Shell Programming and Scripting

Exit code from piping in unix shell script

Hi , I have following code in my shell script : "$TS_BIN/tranfrmr" "${TS_SETTINGS}/tranfrmr_p1.stx" "${TS_LOGS}/tranfrmr_p1.err" | ( "$TS_BIN/cusparse" "${TS_SETTINGS}/cusparse_p2.stx" "${TS_LOGS}/cusparse_p2.err" | ( "$TS_BIN/tsqsort" "${TS_SETTINGS}/srtforpm_p3.stx"... (8 Replies)
Discussion started by: sonu_pal
8 Replies

6. Shell Programming and Scripting

exit shell from a script

hi guys I have a script that I need to terminate or exit the shell or session completely for the user but the exit only exit from the script and takes the user to the shell I found this https://www.unix.com/unix-dummies-questions-answers/399-using-exit-command-shell-script.html saying that... (1 Reply)
Discussion started by: kopper
1 Replies

7. Shell Programming and Scripting

How to grep sql error in shell script and exit the script?

I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts. Here is my script #!/bin/csh -f source .orapass set user = $USER set pass = $PASS cd /opt/data/scripts echo... (2 Replies)
Discussion started by: allinshell99
2 Replies

8. Shell Programming and Scripting

Setting script exit code

#!/bin/ksh row=`sed '1!G;h;$!d' file1.xml | head -2| tail -1` echo "$row" | awk -F"" '{$esum=$5}' row=`sed '1!G;h;$!d' file2.xml | head -2| tail -1` echo "$row" | awk -F"" '{$isum=$5+$19}' echo "Exp:$esnum" echo "Imp:$isum" if then echo "Matched" else echo "Not matched" fi ... (6 Replies)
Discussion started by: skyineyes
6 Replies

9. Shell Programming and Scripting

how to exit out of the calling Shell Script

Hi All, I tried looking for this, but was not able to get a clear answer. Hence posting here. Please find the details below. Thanks for the help I have 2 shell scripts, script1.sh and script2.sh. I call script2.sh from within script1.sh ( by simple ./script2.sh command). Based on some... (7 Replies)
Discussion started by: harimac
7 Replies

10. Shell Programming and Scripting

exit a shell script!!

could somebody tell me please how to exit a shell script: if then echo "No arguments detected" exit 1 fi ... echo "still there" # is displayed .. :-( (4 Replies)
Discussion started by: sami98
4 Replies
Login or Register to Ask a Question