Dear Monks,
I am completely stumped with this one. Any thoughts would be greatly appreciated!
/:perl -v
This is perl, v5.8.8 built for x86_64-linux-thread-multi
My script is called from a wrapper script:
} elsif ($stepType eq 'pl') {
$rc = system("perl $cwd/bin/$step -config=$configFile");
}
The function in question looks like (i think the issue is around line 247):
sub dbConnect(){
238 my ($dbName) = @_;
239 my ($dbh,$dbUser,$dbPass);
240 my $tempStr;
241
242 LogStatus "Retrieving $dbName login info";
243
244 $tempStr = `pwd`;
245 LogStatus "tempStr1: $tempStr";
246
247 $tempStr = `/prod/scripts/getDBlogin abc01`;
248 LogStatus "tempStr: $tempStr";
249 #($dbUser,$dbPass) = split(/\s/,`/prod/scripts/getDBlogin "$dbN
+ame"`);
250 ($dbUser,$dbPass) = split(/\s/, $tempStr);
251 LogStatus "User for $dbName is $dbUser";
252
253 die "$0: Could not find password for $dbUser" unless(defined($d
+bPass));
254
255 $dbh = DBI->connect("dbi:DB2:$dbName", $dbUser, $dbPass, {AutoC
+ommit=> 0, RaiseError => 1})
256 || die "Can't connect to $database: $DBI::errstr";
257
258 LogStatus "Connected to $dbName as $dbUser";
259
260 return $dbh;
261 }
The getDBlogin script looks like:
1 #!/bin/ksh
2
3 dbname=$1
4 idfl=~/$$.idfl
5 grep -i "$dbname " ~/.passwd > $idfl
6 userid=$(cut -f2 -d" " $idfl)
7 pswrd=$(cut -f3 -d" " $idfl)
8
9 rm $idfl
10
11 print "$userid $pswrd"
The log looks like:
365 [2010-05-12 15:12:13] ============================================
+=============
366 [2010-05-12 15:12:13] Script: create_amb_model
367 [2010-05-12 15:12:13] Process Id: 30199
368 [2010-05-12 15:12:13] Start time: Wed May 12 15:12:13 2010
369 [2010-05-12 15:12:13] ============================================
+=============
370 [2010-05-12 15:12:13]
371 [2010-05-12 15:12:13] DDS AMB Model Creation Starting
372 [2010-05-12 15:12:13] Job name: create_amb_model
373 [2010-05-12 15:12:13] Job config: /jobs/dds/create_amb_model
+/config/job.config
374 [2010-05-12 15:12:13] Options: 1
375 [2010-05-12 15:12:13] executing step 1 (dds_prod_pg_load.pl)
376 [2010-05-12 15:12:13] Configuration details:
377 [2010-05-12 15:12:13] Config file: /jobs/dds/create_amb_model
+/config/job.config
378 [2010-05-12 15:12:13] Days back: 365
379 [2010-05-12 15:12:13] Database: abc01
380 [2010-05-12 15:12:13] Retrieving abc01 login info
381 [2010-05-12 15:12:13] tempStr1: /jobs/dds/create_amb_model
382 [2010-05-12 15:12:16] Run job has FAILED
383 [2010-05-12 15:12:16] ERROR:
384 [2010-05-12 15:12:16]
385 [2010-05-12 15:12:16] ============================================
+=============
386 [2010-05-12 15:12:16] Process Id: 30199
387 [2010-05-12 15:12:16] End time: Wed May 12 15:12:16 2010
388 [2010-05-12 15:12:16] Elapsed time: 3 seconds
389 [2010-05-12 15:12:16] CPU time: 0.08 seconds
390 [2010-05-12 15:12:16] ============================================
+=============
So I am never seeing the second log entry after line 381 in the log where I would expect to see the output from getDBlogin. When I execute the script from the command line I am seeing the correct output. It appears that something unexpected is happening around line 247 in dbConnect(). At line 382 in the log I Ctrl-C the process - otherwise it would just hang; this kills the forked process which causes the wrapping script to log out 'Run job has FAILED' when it sees a non-zero return code. I am happy to provide more information if needed.
Thanks in advance!