homepage Welcome to WebmasterWorld Guest from 54.196.168.78
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Running batch file in Perl-Cgi script
gsarin




msg:3910940
 12:28 pm on May 11, 2009 (gmt 0)

Hi,

I am trying to run essbase calc script using esscmd from within a Perl-cgi script using system command.

Below is the flow of my script:
1. User selects the scenario thru HTML form which is sent to perl-CGI script.
2. the script then creates a copy of the calc script and replaces the Scenario word by user selected scenario in the copied file.
3. it then runs the calc script via esscmd using system command.

First two steps are running fine but the third step is problematic, even if I try to run simple command like [system ("START test.bat")], where test.bat script runs the calc script through esscmd.

I have tried the script on both Apache and Tomacat servers.

I also tried modifying config file for Apache as below:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory "C:/Perl">
Order Deny,Allow
Allow from all
AllowOverride None
</Directory>

<Directory "C:/Program files/Apache Group/Apache 2.0/cgi-bin">
Order Deny,Allow
Allow from all
AllowOverride None
</Directory>

The script runs absolutely fine through command prompt and also runs half (till step 2) through webpage. The problem comes when I try to run test.batch file.

I checked the net and found out that if cgi script runs thru command line and does not run through web page, there could be an access/security problem. How do I fix it.? I have already tried adding directives as shown above.

Below is the code.
***********HTML form***********
<HTML><HEAD><TITLE>HTML Form Example</TITLE></HEAD>
<BODY>
<FORM method="GET" action="http://servername:80/cgi-bin/test_cgi.pl" target="_top _blank _self">
<select name="Scenarios">
<option value="Est">Est</option>
<option value="EstA">EstA</option>
</select>
&nbsp;&nbsp;
<INPUT type="submit" Name="Scen" value="Select Scenario">
</FORM>
</BODY></HTML>
*********** ***********

***********Perl Script*************
#!c:\Perl\bin\perl.exe
use Fcntl;
use CGI;

#do Step1 and step2
.
.
.
#Here is when the script gets stuck when run thru IE browser.

system("START test.bat");

#it gets stuck thru web page even if I try using the below commands
#system("esscmd", "E1_test.cmd");
#Or
#system("START test.bat") or die "test.bat failed: $?";
exit (0);
*************** *******************

**********Test.bat**********
esscmd E1_test.cmd
*************** *******************

The script runs fine thru command line in 5 secs even if I use any of the above mentioned system commands.

Also both the test.bat and E1_test.cmd are in apache cgi-bin folder and I have put Execute priveleges for Everyone on the them. Also , i checked the Apache error log and it seems like it gets stuck in processing system command and times out after 4-5 mins.

Any pointers will be appreciated.

Thanks in Advance!.

 

gsarin




msg:3910953
 1:19 pm on May 11, 2009 (gmt 0)

If i try to run

system("esscmd", "E1_test.cmd");
Or
system("E:\\Hyperion\\essbase\\bin\\esscmd", "E1_test.cmd");

in perl script it gives me the following error.

Essbase Command Mode Interface - Release 9.3.1 Failed in GCInit(). Return code [10] ARBORPATH variable isn't set, using default value You should always set ARBORPATH variable Using ARBORPATH [\ARBOR\] ARBORPATH dump: \(5c) A(41) R(52) B(42) O(4f) R(52) \(5c) Path to locale files passed to GCInit() was [\ARBOR\\locale] ESSLANG variable isn't set Could not find the locale files at specified location.

ARBORPATH is set as an environment variable with value E:\Hyperion\Essbase.
esscmd is in E:\hyperion\essbase\bin.

Do I need to set arborpath in somewhere in apache config file as well?

Any pointers will be appreciated.

Thanks in advance!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved