Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling perl script from cgi script 1

Status
Not open for further replies.

chuckecheese

Programmer
Apr 13, 2001
1
US
Hi there,

in desperate need of a solution to enable the execution of a perl script from a cgi script.

Scenario: Web form used to gather arguments for perl script, submitted to 'wrapper' like cgi script in order to parse the info. I would like to use the info to execute a system command something like the following:

system(rsh $hostname /perlprogpath/perlprog -arg1 value1);

I cannot seem to get this to work at all. My current cgi script prints out some html message (confirmation) and then has the system call below, but it never gets executed? HELP!

Any information or leads as to where I can learn about how to implement this would be much appreciated.

 
First, the system function expects to get a list of arguments, comma delimited. You appear to be handing it a space delimited string.

Second, the system call will be running the requested OS command as the web daemon. Usually, system admins set up web server processes (the web daemon) to have very limited permissions. In order for your rsh to work, the web daemon on the first box would have to have all the same characteristics (UID,GID, etc..) as the web daemon on the second box. I would be a little surprised if that were true. If the web daemons, in fact, do have identical UIDs and GIDs, then the rsh should work. Alternatively, if the other machine is running a web server you could simply fire another CGI request to the second server to run the remote piece of code.

#!/usr/local/bin/perl
use LWP::Simple
my $url = '/uri/to/cgi_application/on/the/second/machine/app.cgi';
get($url);

HTH


keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top