|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello all :-),
I am fairly new to writing CGI code using shell scripts. I have put up a site which takes an input via a form and checks a pgsql db for the matching entry and returns the associated fields for that. I want that if that entry is not found in the db I should be able to populate the db in real-time by running another shell script. I added the second program in the cgi-bin folder (sec.sh) and then tried to run it from my main cgi script. It seems that this program just does not run. The code works OK as I have tested on my local machine, I have set the permissions to 755, changed extension to .cgi as well and have tried to get it to work. Even if sec.sh has just echo "hello" > $wd/output , I can see the output file but there is nothing in it!!! Am I missing something crucial regarding what can be executed in the cgi-bin directory? Any advice would be very ful. Thanks, -A Extra information: Hosting agency: Hostmonster.com the sec.sh will ideally contain a wget command and some awk. Awk and wget are installed on the linux system of the hosting provider. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
In article
<8efc5501-7f65-48bb-abfb-ed38e738aae0@e10g2000prf.googlegroups.com>, newbiegalore <banerjee.anirban@gmail.com> wrote: > Hello all :-), > I am fairly new to writing CGI code using shell scripts. I have put > up a site which takes an input via a form and checks a pgsql db for > the matching entry and returns the associated fields for that. I want > that if that entry is not found in the db I should be able to populate > the db in real-time by running another shell script. > > I added the second program in the cgi-bin folder (sec.sh) and then > tried to run it from my main cgi script. It seems that this program > just does not run. The code works OK as I have tested on my local > machine, I have set the permissions to 755, changed extension to .cgi > as well and have tried to get it to work. Even if sec.sh has just echo > "hello" > $wd/output , I can see the output file but there is nothing > in it!!! > > Am I missing something crucial regarding what can be executed in the > cgi-bin directory? Any advice would be very ful. > > Thanks, > -A > > Extra information: Hosting agency: Hostmonster.com > the sec.sh will ideally contain a wget command and some awk. Awk and > wget are installed on the linux system of the hosting provider. You're using the Borne shell to try and populate a database? Well, I'm sure it can be done, but you might check on other tools like maybe perl to do this task. There's even CPAN modules you can install do do CGI and database access directly from perl. And string manipulation is built-in. It's like you asked how to do a database program in FORTRAN IV. Sure, it can be done, but it's way easier to do it in other, more modern languages. Why did you choose the shell? -- DeeDee, don't press that button! DeeDee! NO! Dee... |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Mar 18, 2:32 am, Michael Vilain <vil...@NOspamcop.net> wrote:
> In article > <8efc5501-7f65-48bb-abfb-ed38e738a...@e10g2000prf.googlegroups.com>, > > > > newbiegalore <banerjee.anir...@gmail.com> wrote: > > Hello all :-), > > I am fairly new to writing CGI code using shell scripts. I have put > > up a site which takes an input via a form and checks a pgsql db for > > the matching entry and returns the associated fields for that. I want > > that if that entry is not found in the db I should be able to populate > > the db in real-time by running another shell script. > > > I added the second program in the cgi-bin folder (sec.sh) and then > > tried to run it from my main cgi script. It seems that this program > > just does not run. The code works OK as I have tested on my local > > machine, I have set the permissions to 755, changed extension to .cgi > > as well and have tried to get it to work. Even if sec.sh has just echo > > "hello" > $wd/output , I can see the output file but there is nothing > > in it!!! > > > Am I missing something crucial regarding what can be executed in the > > cgi-bin directory? Any advice would be very ful. > > > Thanks, > > -A > > > Extra information: Hosting agency: Hostmonster.com > > the sec.sh will ideally contain a wget command and some awk. Awk and > > wget are installed on the linux system of the hosting provider. > > You're using the Borne shell to try and populate a database? Well, I'm > sure it can be done, but you might check on other tools like maybe perl > to do this task. There's even CPAN modules you can install do do CGI > and database access directly from perl. And string manipulation is > built-in. > > It's like you asked how to do a database program in FORTRAN IV. Sure, > it can be done, but it's way easier to do it in other, more modern > languages. > > Why did you choose the shell? > > -- > DeeDee, don't press that button! DeeDee! NO! Dee... Well I like using shell scripts and I am just starting out with Perl. I chose the shell because I wanted to get a prototype up and running before I shift to Perl. :-) |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
In article
<8efc5501-7f65-48bb-abfb-ed38e738aae0@e10g2000prf.googlegroups.com>, newbiegalore <banerjee.anirban@gmail.com> wrote: > Hello all :-), > I am fairly new to writing CGI code using shell scripts. I have put > up a site which takes an input via a form and checks a pgsql db for > the matching entry and returns the associated fields for that. I want > that if that entry is not found in the db I should be able to populate > the db in real-time by running another shell script. > > I added the second program in the cgi-bin folder (sec.sh) and then > tried to run it from my main cgi script. It seems that this program > just does not run. The code works OK as I have tested on my local > machine, I have set the permissions to 755, changed extension to .cgi > as well and have tried to get it to work. Even if sec.sh has just echo > "hello" > $wd/output , I can see the output file but there is nothing > in it!!! > > Am I missing something crucial regarding what can be executed in the > cgi-bin directory? Any advice would be very ful. This question would probably be more appropriate for comp.infosystems.www.servers.unix. Are you running the program by full pathname or just the name of the script? I'll bet the cgi-bin directory isn't in $PATH, so if you don't use the full pathname you won't find it. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On 2008-03-18, newbiegalore wrote:
> Hello all :-), > I am fairly new to writing CGI code using shell scripts. I have put > up a site which takes an input via a form and checks a pgsql db for > the matching entry and returns the associated fields for that. I want > that if that entry is not found in the db I should be able to populate > the db in real-time by running another shell script. > > I added the second program in the cgi-bin folder (sec.sh) and then > tried to run it from my main cgi script. It seems that this program > just does not run. The code works OK as I have tested on my local > machine, I have set the permissions to 755, changed extension to .cgi > as well and have tried to get it to work. Even if sec.sh has just echo > "hello" > $wd/output , I can see the output file but there is nothing > in it!!! > > Am I missing something crucial regarding what can be executed in the > cgi-bin directory? Any advice would be very ful. Either put the script in a directory in your PATH, put the cgi-bin directory in your PATH, or call it with the full path to the file. I usually put scripts in $HOME/bin, and add PATH=$PATH:~user/bin to the top of the CGI script. -- Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== and is released under the GNU General Public Licence |
|
![]() |
| Outils de la discussion | |
|
|