Index: trunk/pstamp/scripts/pstamp_job_run.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_job_run.pl	(revision 23267)
+++ trunk/pstamp/scripts/pstamp_job_run.pl	(revision 24831)
@@ -17,4 +17,5 @@
 my $verbose;
 my $dbname;
+my $dbserver;
 my $job_id;
 my $redirect_output;
@@ -25,9 +26,10 @@
 
 GetOptions(
-    'job_id=s'      =>  \$job_id,
-    'output_base=s' =>  \$output_base,
-    'redirect-output' => \$redirect_output,
-    'dbname=s'      =>  \$dbname,
-    'verbose'       =>  \$verbose,
+    'job_id=s'          =>  \$job_id,
+    'output_base=s'     =>  \$output_base,
+    'redirect-output'   => \$redirect_output,
+    'dbname=s'          =>  \$dbname,
+    'dbserver=s'        =>  \$dbserver,
+    'verbose'           =>  \$verbose,
 );
 
@@ -65,4 +67,8 @@
 }
 
+if (!$dbserver) {
+    $dbserver =  metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
+}
+
 my $missing_tools;
 
@@ -83,4 +89,5 @@
     my $command = "$pstamptool -pendingjob -job_id $job_id";
     $command .= " -dbname $dbname" if $dbname;
+    $command .= " -dbserver $dbserver" if $dbserver;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
@@ -118,4 +125,5 @@
     my $command = "$ppstamp -file $uri $outputBase $argString";
     $command .= " -dbname $dbname" if $dbname;
+    $command .= " -dbserver $dbserver" if $dbserver;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
@@ -172,4 +180,5 @@
     my $command = "$pstamp_get_image_job --job_id $job_id --uri $uri --out_dir $outputBase --rownum $rownum";
     $command .= " --dbname $dbname" if $dbname;
+    $command .= " --dbserver $dbserver" if $dbserver;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
@@ -191,4 +200,5 @@
     my $command = "$pstamptool -updatejob -job_id $job_id -state stop -fault $jobStatus";
     $command .= " -dbname $dbname" if $dbname;
+    $command .= " -dbserver $dbserver" if $dbserver;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
