Exit Status 126 - how to get rid of it

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Exit Status 126 - how to get rid of it
# 1  
Old 09-18-2009
Question Exit Status 126 - how to get rid of it

Hi All,

I have a small application hosted on apache-tomcat 5. Basically its a html page which in turn calls a perl script residing on unix server. Through this perl script i am calling a shell script using system command , like


Now in the script 'scriptname.sh' i am try to run a c-program executable which is compiled on unix itself.

The problem is that except that command[c-executable] all other statements gets executed.

On further investigation i found that , it is giving 126 as exit status which means "Command was found but could not be executed".

Can any of you experts please help me to come out of this problem

Thanks in advance. Smilie
# 2  
Old 09-18-2009
Since every process hands down its permissions to its children (UID/GID/...), the script effectively gets called as the user running Tomcat. If that user doesn't have execute permissions on the script, it can't be run.
# 3  
Old 09-18-2009
does not seems to be a permission problem


It does not seems to be a performance problem as i have given 755 permission to all the scripts.

Can there by anything else which restricting it to execute the command
# 4  
Old 09-18-2009
Maybe one of the commands called by the script doesn't have the correct permissions. Other than that the only thing I can think of is scattering some debugging print/echo statements in the Perl or shell script, in order to pinpoint the problem.
# 5  
Old 09-18-2009
You should also give the full path to your shell script when invoking the system() call - not just the name of your shell script.
# 6  
Old 09-23-2009
Question further info..


I have various echo commands in my script and those got printed and the only thing that remains un-touched is the line which calls the executable..


other commands in the script are getting executed without mentioning the full path. So i am just guessing that giving full path will make any difference or not.

Still need your help
thanks in advance..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want to get the exit status

Hi All, I am trying to create a zip file with all the txt files(these are in large number) in the current directory. I am able to do this operation sucessfully. After this i want to get the status of the tar command executed and do accordingly. When i am trying with the below code, the status... (3 Replies)
Discussion started by: paddu
3 Replies

2. Shell Programming and Scripting

Exit Status

I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Discussion started by: smkremer
2 Replies

3. UNIX for Dummies Questions & Answers

service exit status

what are the number for the exit status for command service and what does every number mean. (2 Replies)
Discussion started by: programAngel
2 Replies

4. Shell Programming and Scripting

Exit status of grep

I am trying to get the exit status of grep and test a condition with it, But it does not seem to be working as expected since i am doing something wrong apparently as per grep help Exit status is 0 if match, 1 if no match, and 2 if trouble. My problem is something like this templine - a... (7 Replies)
Discussion started by: prasbala
7 Replies

5. Shell Programming and Scripting

Exit status

I'm preparing for exam and one of exams is to write own test command... I wonder if in unix is a command which just returns exit code you specify.. I know I can easily write a function like this: exStatus() { return $1 } -> my question is rather theoretical thank you! (9 Replies)
Discussion started by: MartyIX
9 Replies

6. Shell Programming and Scripting

How to get the exit status

Hi all, I'm running a program which return 1 upon success. But when encounters problem shell return 's '1' . How to differentiate between them the shell return value and script return value. Ex. function fn return '1' if executed successfully and '0' if failed. But when if shell encounters... (1 Reply)
Discussion started by: yhacks
1 Replies

7. HP-UX

Return of EXIT status ( $? )

I have the question: How return the exit code from then assign : VAR=$(command ) for ex. VAR=$(ls ....) VAREXIT=$? echo $VAREXIT VAREXIT is equal to 0 if the directory exist or not exist. WHI?? if i execute the command direct from line-command , the value of $? is different if... (1 Reply)
Discussion started by: ZINGARO
1 Replies

8. Shell Programming and Scripting

exit status for isql

I'm trying to write a script that will update a table in sysbase. If it's failed then I want to rerun it one more time before exiting the script (fail due to bad value such as trying to put a string into datetime field or bad connection to the database) Well my code below will always return... (2 Replies)
Discussion started by: sirrtuan
2 Replies

9. UNIX for Dummies Questions & Answers

exit status conditions

Hi all, i am writing a script to test if some servers are down and prompt if test positive. i used rlogin and rsh then exit but the script when run, logs into the servers and stays. pls what can i do to salvage this? or what other options do you suggest? (6 Replies)
Discussion started by: sdcoms
6 Replies

10. Shell Programming and Scripting

exit status

i downloaded a text file from metalab.unc.edu called sh.txt and in this reference manual it refers to shell scripting exit status .. at the end of one of the examples that author gave an exit status of 127.. to what does a 127 exit status refer too and what is its purpose in the code. moxxx68 (1 Reply)
Discussion started by: moxxx68
1 Replies
Login or Register to Ask a Question