Unix/Linux Go Back    

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

Calling bash script from CGI


Thread Tools Search this Thread Display Modes
Old Unix and Linux 11-21-2017   -   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


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?

Sponsored Links
Old Unix and Linux 11-21-2017   -   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: 25 May 2018, 3:04 PM EDT
Location: Saskatchewan
Posts: 22,680
Thanks: 1,179
Thanked 4,324 Times in 3,987 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
Old Unix and Linux 11-21-2017   -   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: 24 May 2018, 12:44 PM EDT
Location: Lancashire, UK
Posts: 3,535
Thanks: 1,558
Thanked 692 Times in 622 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?

Sponsored Links

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

All times are GMT -4. The time now is 03:28 AM.