- Timestamp:
- Jun 12, 2026, 2:47:49 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_server_status
r43048 r43052 7 7 8 8 #use DBI; 9 use IPC::Cmd 0.36 qw( can_run run);9 use IPC::Cmd 0.36 qw( can_run ); 10 10 #use PS::IPP::Metadata::Config; 11 use PS::IPP::Config 1.01 qw( :standard );11 use PS::IPP::Config 1.01 qw( :standard ps_run ); 12 12 13 13 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 14 14 use Pod::Usage qw( pod2usage ); 15 use Scalar::Util qw(looks_like_number);16 15 17 16 my ($rundir, $workdir, $verbose, $save_temps); … … 71 70 my $serverRunning = 0; 72 71 my $command = "$pantasks_client < $pantasks_script"; 73 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 74 run(command => $command, verbose => $verbose); 75 my $error_code = &parse_error_message ($success, $error_msg, $command); 72 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 73 ps_run(command => $command, verbose => $verbose); 76 74 if ($success) { 77 75 $serverRunning = 1; 78 76 } else { 79 $error_code = ( $error_codeor 1);77 $error_code = (($error_code >> 8) or 1); 80 78 if ($error_code == 12 || $error_code == 13) { 81 79 print "Postage Stamp Server is not running\n<br>"; … … 206 204 207 205 exit 0; 208 209 # if the program exited normally, the exit value is returned210 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned211 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned212 sub parse_error_message {213 my $success = shift;214 my $error_msg = shift;215 my $command = shift;216 217 if ($success) { return 0; }218 219 print "raw error_msg: $error_msg\n";220 print "full command: $command\n";221 222 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }223 224 # which of these match?225 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;226 if (defined $error_code) { return $error_code; }227 228 ($error_code) = $error_msg =~ m/died with signal (\d+)/;229 # if (defined $error_code) { return (128 + $error_code); }230 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }231 232 # probably failed to execute:233 return (-1*$PS_EXIT_PROG_ERROR);234 }
Note:
See TracChangeset
for help on using the changeset viewer.
