Index: /trunk/pstamp/scripts/ppstamp_run.pl
===================================================================
--- /trunk/pstamp/scripts/ppstamp_run.pl	(revision 16282)
+++ /trunk/pstamp/scripts/ppstamp_run.pl	(revision 16283)
@@ -96,19 +96,25 @@
 }
 
+my $jobStatus;
 {
     my $command = "$ppstamp -file $uri $outputBase $argString";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbosity);
-###
-### update the status of the job with the error
-###
-    unless ($success) {
-        die("Unable to perform $command: $error_code");
+
+    if ($success) {
+        $jobStatus = "ok";
+    } else {
+        $jobStatus = $error_code;
+        print STDERR "ppstamp failed with error code $error_code\n";
     }
+#    unless ($success) {
+#        die("Unable to perform $command: $error_code");
+#    }
 }
 
 
+# stop the job and set the error status
 {
-    my $command = "$pstamptool -processedjob -job_id $job_id -state stop -status ok";
+    my $command = "$pstamptool -processedjob -job_id $job_id -state stop -status $jobStatus";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbosity);
@@ -119,3 +125,3 @@
 
 
-exit 0;
+exit $jobStatus;
Index: /trunk/pstamp/scripts/pstamp_dorequest.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_dorequest.pl	(revision 16282)
+++ /trunk/pstamp/scripts/pstamp_dorequest.pl	(revision 16283)
@@ -16,5 +16,5 @@
 my $request_id = $ARGV[0];
 
-my $verbosity = 0;
+my $verbosity = 1;
 
 use Sys::Hostname;
@@ -78,4 +78,5 @@
         if ($job->{req_id} == $request_id) {
             # there must be a better way to do this
+            print STDERR "adding $job->{job_id} to the list\n";
             $psjobs[@psjobs] = $job;
         }
@@ -90,5 +91,5 @@
 
 foreach my $job (@psjobs) {
-    my $command = "echo $ppstamp_run $job->{job_id}";
+    my $command = "$ppstamp_run $job->{job_id}";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbosity);
@@ -100,5 +101,5 @@
 
 #
-# set the state of the request to stop
+# Update the state of the request
 #
 
Index: /trunk/pstamp/scripts/pstampwebrequest.sh
===================================================================
--- /trunk/pstamp/scripts/pstampwebrequest.sh	(revision 16282)
+++ /trunk/pstamp/scripts/pstampwebrequest.sh	(revision 16283)
@@ -12,4 +12,8 @@
 #
 # Note: there's nothing really web specific about this program.
+#       with the exception that we set up the environment to allow a 
+#       random user (in this case apache ) to run ipp programs
+#
+# TODO: re-write this in perl
 #
 ###
@@ -42,5 +46,4 @@
 
 # These variables need to be customized for a particular installation
-BASE_DIR=/export/data1/bills/pstamp
 export PSCONFDIR=/export/data0/bills/psconfig
 
@@ -48,8 +51,9 @@
 export LD_LIBRARY_PATH=/usr/local/lib
 
+WORK_DIR=/export/data1/bills/pstamp/work
+CMD_DIR=/export/data0/bills/src/ipp/pstamp/scripts
+
 #### END LOCAL_CONFIGURATION
 
-WORK_DIR=$BASE_DIR/work
-CMD_DIR=$BASE_DIR/bin
 export HOME=$WORK_DIR
 
@@ -67,9 +71,15 @@
 
 
-## configure IPP
+###
+### configure IPP
+###
 export MANPATH=""
 
 source $PSCONFDIR/psconfig.bash default
 
+###
+### Add our command directory to the path. This won't be necessary once the scripts get
+### installed in the IPP
+###
 PATH=${CMD_DIR}:${PATH}
 
@@ -149,7 +159,10 @@
 
 ###
-### TODO: Won't it interfere with pantask's job processing?
-###
-### Queue jobs for the request
+### TODO: Until we have pantasks monitoring the reuest and job table
+### run things directly
+
+
+###
+### Queue the jobs for the request
 ###
 pstampparser_run.pl $request_id  1> $parse_out 2> $parse_err
@@ -166,22 +179,19 @@
 fi
 
-cat $parse.out
-
-### for each line in the output add a psJob to the 
-
 ###
 ### Ok now it's time to build the stamps
+###
 
 stamp_out=stamp.${out_ext}
 stamp_err=stamp.${err_ext}
 
-echo making stamps > $stamp_err
-
-###
-### Make the stamps
+echo making stamps for request> $stamp_err
+
+###
+### Make the stamps by executing each of the jobs
 ###
 pstamp_dorequest.pl $request_id 1>$stamp_out 2>>$stamp_err
 if [[ $? != 0 ]]; then
-    echo makestamps.pl failed
+    echo pstamp_do_request.pl failed
     echo STDERR:
     cat $stamp_err
@@ -192,7 +202,6 @@
 fi
 
-# Success print the output
-# get the stamp urls
-cat $stamp_out
+# Success print the urls
+pstamptool -listjob -req_id $request_id -simple | awk '{ print $6 ".fits" }'
 
 cleanup
Index: /trunk/pstamp/web/request.php
===================================================================
--- /trunk/pstamp/web/request.php	(revision 16282)
+++ /trunk/pstamp/web/request.php	(revision 16283)
@@ -14,4 +14,7 @@
 <pre>
 <?php 
+
+$COMMAND_DIR = "/export/data0/bills/src/ipp/pstamp/scripts";
+$STAMPS_DIR = "stamps";
 
 // Initialize variables
@@ -416,4 +419,5 @@
     global $rvar_id, $rvar_class_id;
     global $command_line;
+    global $STAMPS_DIR;
 
     $cmd = "pstampwebrequest.sh";
@@ -430,5 +434,5 @@
         throw new Exception('Stamp Name must be specified.');
     }
-    $cmd .= " -user_tag $rvar_user_tag";
+    $cmd .= " -user_tag $STAMPS_DIR/$rvar_user_tag";
 
     // Set up the ROI parameters
@@ -493,11 +497,8 @@
     global $error_line;
     global $command_status;
-
-    $HOME = "/export/data1/bills/pstamp";
-    $cmd_dir  = "$HOME/bin";
-    $work_dir = "$HOME/work";
-
-
-    exec ("$cmd_dir/$command_line", $output_array, $command_status);
+    global $COMMAND_DIR;
+
+
+    exec ("$COMMAND_DIR/$command_line", $output_array, $command_status);
 
     $size = sizeof($output_array);
@@ -520,9 +521,14 @@
 function printURL($path)
 {
-    $fileName = basename($path);
     echo "<tr><td>";
-    echo "<a href=\"http:$path\" target=\"_blank\" type=\"image/fits\">";
-    echo $fileName;
-    echo "</a>";
+    $doURL = 1;
+    if ($doURL) {
+        $fileName = basename($path);
+        echo "<a href=\"http:$path\" target=\"_blank\" type=\"image/fits\">";
+        echo $fileName;
+        echo "</a>";
+    } else {
+        print "$path";
+    }
     echo "</td></tr>";
 }
