×
UNIX.COM Login
Username:
Password:  
Show Password






👤


Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Exit code 267 from shell script

Tags
exit code 267, linux

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-09-2018
Arunnath Arunnath is offline
Registered User
 
Join Date: Mar 2018
Last Activity: 9 March 2018, 9:32 AM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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:
Exit code 267 from shell script Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-09-2018 at 09:40 AM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old 03-09-2018
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 16 July 2018, 3:46 PM EDT
Location: Aachen, Germany
Posts: 13,062
Thanks: 447
Thanked 4,011 Times in 3,688 Posts
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?
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to capture the exit code of a shell script in a perl script.? Little Shell Programming and Scripting 3 08-26-2013 11:20 AM
Exit a shell script Phuti Shell Programming and Scripting 2 04-24-2013 08:18 AM
How to capture exit code of child script and send it to parent script? aroragaurav.84 Shell Programming and Scripting 1 03-22-2013 03:44 PM
Exit code from piping in unix shell script sonu_pal Shell Programming and Scripting 8 06-11-2012 09:21 AM
exit a shell script!! sami98 Shell Programming and Scripting 4 03-27-2007 04:55 AM



All times are GMT -4. The time now is 10:01 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.