Unix/Linux Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Exit Status 126 - how to get rid of it

UNIX for Advanced & Expert Users


Tags
apache-tomcat, exit status, perl, shell

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 09-18-2009
glamo_2312 glamo_2312 is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 18 February 2010, 6:47 AM EST
Location: INDIA
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux 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

system('scriptname.sh',arg1,arg2,arg3);

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. Linux
Sponsored Links
    #2  
Old Unix and Linux 09-18-2009
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,521
Thanks: 38
Thanked 335 Times in 308 Posts
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.
Sponsored Links
    #3  
Old Unix and Linux 09-18-2009
glamo_2312 glamo_2312 is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 18 February 2010, 6:47 AM EST
Location: INDIA
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
does not seems to be a permission problem

Hi

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 Unix and Linux 09-18-2009
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,521
Thanks: 38
Thanked 335 Times in 308 Posts
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.
Sponsored Links
    #5  
Old Unix and Linux 09-18-2009
fpmurphy's Unix or Linux Image
fpmurphy fpmurphy is offline Forum Advisor  
who?
 
Join Date: Dec 2003
Last Activity: 12 June 2016, 11:03 PM EDT
Location: /dev/ph
Posts: 4,996
Thanks: 73
Thanked 475 Times in 437 Posts
You should also give the full path to your shell script when invoking the system() call - not just the name of your shell script.
Sponsored Links
    #6  
Old Unix and Linux 09-23-2009
glamo_2312 glamo_2312 is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 18 February 2010, 6:47 AM EST
Location: INDIA
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux Question further info..

@pludi..

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..

@fmurphy

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..
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Exit status MartyIX Shell Programming and Scripting 9 09-09-2008 05:47 AM
How to get the exit status yhacks Shell Programming and Scripting 1 05-19-2008 08:06 AM
exit status moxxx68 Shell Programming and Scripting 1 12-04-2004 06:27 PM
tar exit status thorndike UNIX for Dummies Questions & Answers 3 01-22-2002 03:39 PM
ftp exit status. oracle8 UNIX for Advanced & Expert Users 1 10-21-2001 11:34 PM



All times are GMT -4. The time now is 07:40 PM.