Changeset 16591 for trunk/pstamp/scripts
- Timestamp:
- Feb 21, 2008, 6:38:46 PM (18 years ago)
- Location:
- trunk/pstamp/scripts
- Files:
-
- 1 added
- 1 deleted
- 3 edited
-
ppstamp_run.pl (modified) (5 diffs)
-
pstamp_dorequest.pl (modified) (1 diff)
-
pstamp_parser_run.pl (added)
-
pstamp_runcommand.sh (modified) (4 diffs)
-
pstampparser_run.pl (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/ppstamp_run.pl
r16358 r16591 15 15 my $job_id = $ARGV[0]; 16 16 17 my $verbosity = 0;17 my $verbosity = 1; 18 18 19 19 use Sys::Hostname; 20 20 my $host = hostname(); 21 21 22 print "\n\n"; 22 23 print "Starting script $0 on $host\n\n"; 24 23 25 use IPC::Cmd 0.36 qw( can_run run ); 24 26 … … 58 60 run(command => $command, verbose => $verbosity); 59 61 unless ($success) { 60 die("Unable to perform pstamptool -pending req: $error_code");62 die("Unable to perform pstamptool -pendingjob: $error_code"); 61 63 } 62 64 63 65 if (@$stdout_buf == 0) { 64 66 print STDERR "pending pstamp job id $job_id not found\n"; 65 exit 1; 67 # exit 1; 68 exit 0; 66 69 } 67 70 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or … … 82 85 my $outputBase = $psjob->{outputBase}; 83 86 my $argString = $psjob->{args}; 84 #my $request_id = $psjob->{req_id};85 86 #87 # update the state of this job from 'new' to 'run'88 #89 {90 my $command = "$pstamptool -processedjob -job_id $job_id -state run";91 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =92 run(command => $command, verbose => $verbosity);93 unless ($success) {94 die("Unable to perform $command: $error_code");95 }96 }97 87 98 88 my $jobStatus; … … 103 93 104 94 if ($success) { 105 $jobStatus = "ok";95 $jobStatus = $PS_EXIT_SUCCESS; 106 96 } else { 107 $jobStatus = $error_code; 108 print STDERR "ppstamp failed with error code $error_code\n"; 97 # run shifts the unix exit status up by 8 bits for some reason 98 $jobStatus = $error_code >> 8; 99 print STDERR "ppstamp failed with error code: $jobStatus\n"; 109 100 } 110 # unless ($success) {111 # die("Unable to perform $command: $error_code");112 # }113 101 } 114 102 115 103 116 # stop the job and set the error status104 # stop the job and set the result value 117 105 { 118 my $command = "$pstamptool -processedjob -job_id $job_id -state stop - status$jobStatus";106 my $command = "$pstamptool -processedjob -job_id $job_id -state stop -result $jobStatus"; 119 107 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 120 108 run(command => $command, verbose => $verbosity); … … 124 112 } 125 113 126 127 if ($jobStatus eq "ok") { 128 exit 0; 129 } else { 130 exit $jobStatus; 131 } 114 exit $jobStatus; -
trunk/pstamp/scripts/pstamp_dorequest.pl
r16358 r16591 4 4 ### 5 5 ### Excecute the jobs for a given request. 6 ### Note: This is intended for testing outside of pantasks environment 6 ### 7 ### Note: This program is not part of the postage stamp server 8 ### It is intended for testing outside of pantasks environment 7 9 ### 8 10 -
trunk/pstamp/scripts/pstamp_runcommand.sh
r16358 r16591 2 2 ### 3 3 # 4 # pstampwrapper.sh: 5 # Set up the ipp environment to run a ipp commands on behalf of hte postage stamp 4 # pstamp_runcommand.sh: 5 # 6 # Set up the ipp environment to run a ipp commands on behalf of the postage stamp 6 7 # server and execute the command given by the argument list 8 # This script is used by cgi or php scripts. 7 9 8 10 if [[ $# == 0 ]] ;then … … 15 17 16 18 # These variables need to be customized for a particular installation 19 # XXX: why not pass these on on the command line ? 17 20 export PSCONFDIR=/export/data0/bills/psconfig 18 19 # TODO shouldn't need to do this but there seems to be a psconfig problem.20 # Gene fixed this recently21 #export LD_LIBRARY_PATH=/usr/local/lib22 21 23 22 WORK_DIR=/export/data1/bills/pstamp/work … … 30 29 cd $WORK_DIR 31 30 status=$? 32 if [[ ! $status]] ; then31 if [[ $status != 0 ]] ; then 33 32 echo $0 cannot cd to WORK_DIR: $WORK_DIR status: $status >&2 34 33 exit $status 35 34 fi 36 35 37 # TODO: I do this so that I have permissions to modify the files created by38 # the web server user apache.39 #umask 040 41 36 ### 42 ### configure IPP37 ### configure the IPP 43 38 ### 44 #export MANPATH=""45 39 46 40 source $PSCONFDIR/psconfig.bash default 47 41 status=$? 48 if [[ ! $status]] ; then42 if [[ $status != 0 ]] ; then 49 43 echo error setting up IPP environment >&2 50 44 exit $status … … 53 47 ### 54 48 ### Add our command directory to the path. 55 ### TODO: This won't be necessary once the scripts get installed as part of the IPP49 ### XXX: This won't be necessary once the scripts get installed as part of the IPP 56 50 ### 57 51 PATH=${CMD_DIR}:${PATH} 58 52 59 ## This test is sort of redundant. 60 ## We'll get a more useful error by just going ahead and trying the command 61 ## or by not suppressing the output from which 53 ## make sure we are able to run the desired command 54 ## XXX: This test is sort of redundant. 55 ## We'd get a more useful error by just going ahead and trying the command 56 ## or by not suppressing the error output of which 62 57 if [[ ! -x `which $1 2> /dev/null` ]] ;then 63 58 status=$?
Note:
See TracChangeset
for help on using the changeset viewer.
