Changeset 43052 for branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_save_server_status.pl
- Timestamp:
- Jun 12, 2026, 2:47:49 PM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_save_server_status.pl
r43048 r43052 7 7 use warnings; 8 8 9 use PS::IPP::Config 1.01 qw( :standard );10 use IPC::Cmd 0.36 qw( can_run run);9 use PS::IPP::Config 1.01 qw( :standard ps_run ); 10 use IPC::Cmd 0.36 qw( can_run ); 11 11 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 12 12 use Pod::Usage qw( pod2usage ); 13 use Scalar::Util qw(looks_like_number);14 13 15 14 my $updatelink; … … 64 63 my $command = "pstamp_server_status --workdir $pstamp_workdir > $file"; 65 64 #my $command = "pstamp_server_status > $file"; 66 my ( $success, $error_msgo, $full_buf, $stdout_buf, $stderr_buf ) = 67 run(command => $command, verbose => $verbose); 68 my $error_code = &parse_error_message ($success, $error_msg, $command); 65 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 66 ps_run(command => $command, verbose => $verbose); 69 67 unless ($success) { 70 $error_code = ( $error_codeor 1);68 $error_code = (($error_code >> 8) or 1); 71 69 warn("$command failed. exit status: $error_code"); 72 70 exit $error_code; … … 82 80 83 81 exit 0; 84 85 # if the program exited normally, the exit value is returned86 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned87 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned88 sub parse_error_message {89 my $success = shift;90 my $error_msg = shift;91 my $command = shift;92 93 if ($success) { return 0; }94 95 print "raw error_msg: $error_msg\n";96 print "full command: $command\n";97 98 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }99 100 # which of these match?101 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;102 if (defined $error_code) { return $error_code; }103 104 ($error_code) = $error_msg =~ m/died with signal (\d+)/;105 # if (defined $error_code) { return (128 + $error_code); }106 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }107 108 # probably failed to execute:109 return (-1*$PS_EXIT_PROG_ERROR);110 }
Note:
See TracChangeset
for help on using the changeset viewer.
