dengguochen2003 has asked for the wisdom of the Perl Monks concerning the following question:
1 sub ptrace { 2 my ($msg, $level) = @_; 3 $msg = pdate()." ".$msg; 4 ptrace_wo_date($msg, $level); 5 } 6 7 sub ptrace_wo_date { 8 my ($msg, $level) = @_; 9 $level = defined $level ? $level : $norm_trace; 10 if ($traceLevel >= $level) { 11 if ($ttymode) { 12 print "$msg\n"; 13 } 14 if ($log_opened) { 15 print $logfh "$msg\n"; 16 } 17 } 18 } 19 20 sub plog { 21 my $msg = shift; 22 if ($ttymode) { 23 $msg = pdate()." ".$msg; 24 } 25 if ($log_opened) { 26 print $logfh "$msg\n"; 27 } 28 } 29 30 # Main part 31 32 my $pit_trace = "/tmp/pit.trace"; 33 my $cmd = "/tmp/FMinstall.sh" 34 ptrace("-I- executing: \n\t$cmd"); 35 system("$cmd > /tmp/instappcmd.out 2>&1"); 36 my $res = $? >> 8; 37 my $pitres = readFile("/tmp/instappcmd.out"); 38 unlink "/tmp/instappcmd.out"; 39 40 # log result and pit trace if any 41 ptrace(" execution trace:\n$pitres"); 42 43 if ( -f $pit_trace ) { 44 $pitres = readFile($pit_trace); 45 plog($pitres); 46 }
Below is the log from the above code. Lines 1 and 2 are print on 2/14, and it hangs there. After 20 hours when I login into the console of the machine lines 4 and later come out. From the time stamp on line 4 we can see the 3rd line of code should be executed on 2/14, then the code goes into the ptrace_wo_date() function, and comes to code on line 12, but it hangs there for 20 hours when I login on 2/15 it resumes. Then the code comes to line 45 and plog() prints the time stamp in below log line 21, which is 2/15.
My question is what is the possible reasons for the print() hangs. Why it resumes when I login on the console. I am on IBM machine with Console Access through terminal Server InReach MRV Port 3122. Appreciate your any comments on this in advance.
1 2013/02/14 16:25:20 -I- executing: 2 /tmp/FMinstall.sh 3 4 2013/02/14 16:50:12 execution trace: 5 6 Execution of FMinstall.sh ... 7 8 2013-02-14 16:25:22 INFO Stopping FM 9 2013-02-14 16:25:22 INFO FM instance name: player1 10 Last login: Thu Feb 14 16:24:16 GMT 2013 on console 11 Instance player1 is already in the STOPPED state. 12 Last login: Thu Feb 14 16:24:16 GMT 2013 on console 13 2013-02-14 16:25:23 INFO FM Stopped 14 15 -I- Stopping FM player2 instance 16 17 2013-02-14 16:25:23 INFO Stopping FM 18 2013-02-14 16:25:23 INFO FM instance name: player2 19 ... ... 20 21 2013/02/15 12:33:27 2013/02/14 16:50:12:Audit:event(2)::SYSTEM +():================================================== 22 2013/02/14 16:50:12:Audit:event(2)::SYSTEM(): Starting the Aud +it tool. 23 2013/02/14 16:50:12:Audit:event(2)::SYSTEM():================= +================================= 24 2013/02/14 16:50:12:Audit:debug(4)::RepositoryXml.parseReposit +oryFile():Reading file </usr/repository/products.xml>. 25 2013/02/14 16:50:12:Audit:debug(4)::Repository.Repository():Co +ntent of repository :