Help, shell commands not working from within script 
Author Message
 Help, shell commands not working from within script

: I have a script that I just wrote, and here is my problem.  Within the perl
: script I do a system("whatever command");  I have also tried using a back
: quote.  This works great as long as I am running it from within the unix
: command prompt.  However, it never returns anything if it is from a web
: page call.

: Actually, I have noticed that the command never even gets executed.  I
: tried just doing a touch on a non-existent file, and it never gets created
: (unless I run it direct from within unix).

: Any help would be GREATLY appreciated.
  ^^^^^^^^

Perl FAQ, part 9, the very first Frequently Asked Question:

-------------------------
=head2 My CGI script runs from the command line but not the browser.  Can you help me fix it?

Sure, but you probably can't afford our contracting rates :-)

Seriously, if you can demonstrate that you've read the following FAQs
and that your problem isn't something simple that can be easily
answered, you'll probably receive a courteous and useful reply to your
question if you post it on comp.infosystems.www.authoring.cgi (if it's
something to do with HTTP, HTML, or the CGI protocols).  Questions that
appear to be Perl questions but are really CGI ones that are posted to
comp.lang.perl.misc may not be so well received.

The useful FAQs are:

    http://www.*-*-*.com/
    http://www.*-*-*.com/
    http://www.*-*-*.com/
    http://www.*-*-*.com/
    http://www.*-*-*.com/
-------------------------

All that help available for your problem. And it is not even
a Perl problem. It is a CGI problem. You should consider using
the CGI newsgroup for asking CGI questions:

comp.infosystems.www.authoring.cgi

Several possible problems are presented in the FAQs above.

1) did you check the return code from the system command?

   if (system("whatever command")) {
      warn "Uh oh! Something went wrong.   $! \n";
   }

2) did the user that the CGI script runs as (often 'nobody') have
   the appropriate permissions for files and directories?

3) did you use the complete path to the commands?

   /usr/local/bin/whatever

: Thanks,

And thank you for doing your part to ensure that the 'F' in FAQ
remains accurate ;-)

--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming



Tue, 09 Nov 1999 03:00:00 GMT  
 Help, shell commands not working from within script

I have a script that I just wrote, and here is my problem.  Within the perl
script I do a system("whatever command");  I have also tried using a back
quote.  This works great as long as I am running it from within the unix
command prompt.  However, it never returns anything if it is from a web
page call.

Actually, I have noticed that the command never even gets executed.  I
tried just doing a touch on a non-existent file, and it never gets created
(unless I run it direct from within unix).

Any help would be GREATLY appreciated.

Thanks,

Jim Scofield



Wed, 10 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. shell script from within a shell script

2. Executing a shell command within a perl script.

3. Executing a shell command within a perl script.

4. System call works at command line but not within CGI

5. My <!--#exec cgi="\scripts\script.pl"-->command will not work

6. Scripts work from shell but not browser

7. Calling shell scripts or shell commands from Perl

8. Repost Script Works from Command Prompt but Not via Webserver

9. How to run shell command from within perl?

10. Blat works from command line but not in CGI script

11. HELP: Piping shell command into perl command?

12. command interface (not a shell)

 

 
Powered by phpBB® Forum Software