I've been banging my head against the wall with this one. I have a script that runs as follows:
./script.sh var1 var2 var3
This all works well in the shell (bash) with the variable arguements. However, what I really want to do it run this script from a webpage so that a user can complete a form and the separate entries for each form box are read into the script as arguements. Unfortunately I can't get it to work... here's the HTML code:
<link href="stylesheets/common.css" type="text/css" rel="stylesheet">
<h1>Enter Customer Details Below:</h1>
<form name="input" action="/cgi-bin/addcustomer.sh" method="get">
<type="text" name="1" value="webui">
Customer name (Company): <br>
<input type="text" name="CUSTOMER_NAME" />
IP Address: <br>
<input type="text" name="IP_ADDRESS" />
<input type="submit" value="Submit" />
I've got the script "addcustomer.sh" in the right directory for the CGI as specified in the apache2 configuration but it doesn't run. Permissions should be correct as well as I'm basically tweaking the Nagios gui to add in new "customers". The script works fine in the shell, but just won't happen when I use the webpage. I get the following error onscreen:
The requested URL /cgi-bin/addcustomer-ips.sh was not found on this server
... but it definately is in the cgi-bin directory!
It's worth noting that the bash script is written so that if $1 = "webui" it knows that it's being run from the apache2 server and not the command line so it skips the interactive parts of the script... I didn't want to write the same thing twice
. Also "CUSTOMER_NAME" and "IP_ADDRESS" are variables in the script.
Any ideas or a point in the right direction would be most appreciated!