Subject: G94: Running G94 from cgi script.

From: <[email-masked]>
Date: Fri, 14 Jun 1996 15:04:17 +1100 (EETDT)

Hi all,

I have been setting up web pages that run Gaussian from a perl
cgi script. There are two actions :- (1) the job is run in a
NQS queue and the output either e-mailed to the user or printed;
(2) the job is run interactively and the results sent to the
browser. Both actions (1) and (2) work fine on a server on
a Dec Alpha. Only (1) works on a IBM RS6K. Both servers are
running NCSA httpd. 

The interactive scripts on the RS6K just do nothing and this problem
has been worrying me for many weeks. Here is the problem stripped
down to just bare essentials. 

The html page:-
<HTML> <HEAD>
<TITLE>Test1</TITLE>
</HEAD> <BODY>
<H1 ALIGN=center>Test1.</H1>
<FORM METHOD="post" ACTION="/cgi-bin/test1.pl">
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset"><P>
</FORM>
</BODY> </HTML>

sends no data (as the main page would) and just posts to a cgi
script. If the script is

#!/usr/local/bin/perl
#
$ENV{'g94root'} = '/var';
$ENV{'GAUSS_EXEDIR'} = '/var/g94/bsd:/var/g94';
$ENV{'GMAIN'} = '/var/g94/bsd:/var/g94';
$ENV{'PATH'} = '/usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/lbin:/usr/bin/X11:/sbin:/var/g94/bsd:/var/g94:.';

system ("testrt \"#N \" > t.log");

print "Content-type: text/html\n\n";
print "<TITLE>Test</TITLE>\n\n";
print "<H1 ALIGN=center>Test done</H1>\n\n";
print "</BODY></HTML>\n";

it just returns "Test done" and leaves t.log created but empty. Note 
this does not even run G94. It runs the small gaussian utility testrt.
This script runs at the prompt fine and puts the testrt output into
t.log.

In order to try to understand this further I tried stuff like this 
script:-

#!/usr/local/bin/perl
#
$ENV{'g94root'} = '/var';
$ENV{'GAUSS_EXEDIR'} = '/var/g94/bsd:/var/g94';
$ENV{'GMAIN'} = '/var/g94/bsd:/var/g94';
$ENV{'PATH'} = '/usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/lbin:/usr/bin/X11:/sbin:/var/g94/bsd:/var/g94:.';

$job = "t.job";

# write the job file
open(JOB, "> $job") || die "Damn! Can't create $job!\n";
print JOB "#!/bin/ksh\n";
print JOB "whence testrt > t.log\n";
print JOB "testrt \"#N \" >> t.log 2>&1\n";
close(JOB);

chmod 0775, $job;
system "./$job";

print "Content-type: text/html\n\n";
print "<TITLE>Test</TITLE>\n\n";
print "<H1 ALIGN=center>Test done</H1>\n\n";
print "</BODY></HTML>\n";

Here a korn shell script is created and run. The whence line gives
the correct result, while again nothing goes into t.log. The shell
script and the full perl script both run correctly from the prompt.
The script can contain all sorts of commands that work fine. I have used
printenv to check the environment and so on. I have moved other code into
the g94 directory with the same permissions and ownership as the g94
executables. They work. The httpd runs as user web. I had it running
as nobody before. The results are the same. The server on the Dec is running
as web. Remember that there the same scripts run just fine.The cgi script 
from the web leaves this error in the error_log file:-

 ./t.job[3]: 7496 Killed

If I use C-shell, I get no error message, but it does not do anything. 
Clearly the testrt call on line 3 has been started as process 7496, 
but then killed.

Can anyone:-

1. Suggest what is wrong?
2. Suggest how to get more information about the "Killed" message?
   I would prefer not to have to alter the Gaussian code.
3. Run the above on a web server running on a RS6K (AIX 3.2 preferably)?

I would really welcome some feedback on this. It is driving me mad and
we do need to get both batch and interactive use from the web server on 
the RS6K. I want to use the Dec alpha for research when I have finished
marking examinations next week.

Sorry this has been so long. I think it is relevant to CCL as it seems
to be a G94 problem and the use of CC code off web servers has some real
educational value. My students love it. It is just working on the wrong
damn machine!

Cheers, Brian.
-- 
        Associate Professor Brian Salter-Duke (Brian Duke)
School of Mathematical and Physical Sciences, Northern Territory University,
  Darwin, NT 0909, Australia.  Phone 08-89466702. Fax 08-89410460
e-mail: [email-masked]  WWW http://lacebark.ntu.edu.au/chemistry