Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Calling bash script from CGI

Programming


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 3 Weeks Ago   -   Original Discussion by Naveen.6025
Naveen.6025's Unix or Linux Image
Naveen.6025 Naveen.6025 is offline
Registered User
 
Join Date: Aug 2012
Last Activity: 21 November 2017, 9:06 AM EST
Posts: 17
Thanks: 3
Thanked 0 Times in 0 Posts
Calling bash script from CGI

Hi,

I am having two individual scripts

Script 1): CGI script - is a simple script which trigger bash script
Script 2): Bash script - is a script which execute which collects file system utilization information from all the Unix servers

If I am executing CGI script manually from command line it is working fine but executing it through browser it is not working(CGI script is not able to call bash script)

How can i configure to run a bash script inside a CGI script?

Thanks
N
Sponsored Links
    #2  
Old Unix and Linux 3 Weeks Ago   -   Original Discussion by Naveen.6025
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 11 December 2017, 5:38 PM EST
Location: Saskatchewan
Posts: 22,546
Thanks: 1,159
Thanked 4,286 Times in 3,955 Posts
Without seeing the code for either of them, I can't really do anything but guess.

If you want my guess, make sure PATH has a sane value before you call the BASH script.
Sponsored Links
    #3  
Old Unix and Linux 2 Weeks Ago   -   Original Discussion by Naveen.6025
rbatte1's Unix or Linux Image
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 12 December 2017, 9:05 AM EST
Location: Lancashire, UK
Posts: 3,407
Thanks: 1,477
Thanked 669 Times in 602 Posts
I would assume that it is something about an incorrect path. What does it say in the webserver logs, e.g. /var/log/httpd/access.log or .../error.log

Can you write the CGI to return information about what it is trying to do to the screen? If it's Perl CGI, something like printf "Here I am\n" ; should give you a message. You can then experiment with what it shows you so you can see what you are really trying to call, and if it exists. Remember that your CGI script will be running as the webserver, not yourself.


As another thought, how will you stop someone just connecting and running this over & over again, clogging up your server?




Robin
Sponsored Links
Reply

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
Calling msys shell from bash script sweetu1995 Shell Programming and Scripting 5 06-16-2015 01:22 AM
Calling function from another bash script kristinu Shell Programming and Scripting 11 04-05-2012 11:32 AM
Calling a Perl script in a Bash script -Odd Situation leepet01 Shell Programming and Scripting 5 09-15-2011 05:56 PM
Calling BASH script from JAVA lakshman.forums Red Hat 0 05-23-2011 12:24 PM
Calling bash command in perl script sQew Shell Programming and Scripting 12 12-08-2010 06:15 AM



All times are GMT -4. The time now is 11:42 AM.