root/gs3-extensions/pharos/trunk/cmdline-api-srcpack/bin/script/imageis-query-by-id.sh @ 20989

Revision 20989, 0.9 KB (checked in by davidb, 11 years ago)

Improved error reporting

Line 
1#!/bin/bash
2
3if [ $# != 2 ] ; then
4  echo "Usage: imageis-query-by-id.sh col id"
5  exit
6fi
7
8col=$1
9id=$2
10
11docid=$col:$id
12
13echo "Generating query_id.xml"
14cat "$IMAGEISHOME/templates/query_id.xml" \
15  | sed "s@\*\*docid\*\*@$docid@g" \
16  > "/tmp/vsupload/query_id.xml"
17
18echo "Querying by $docid"
19
20java -jar "$IMAGEISHOME/ImageIS.jar" "/tmp/vsupload/query_id.xml"
21
22if [ $? == "0" ] ; then
23  /bin/rm "/tmp/vsupload/query_id.xml"
24fi
25
26if [ ! -f image_cbs_result.xml ] ; then
27  echo ""
28  echo "Error: Failed to generate image_cbs_result.xml"
29  echo "       Check catalina.out for server-side error messages"
30  echo ""
31  exit 1
32elif [ ! -s image_cbs_result.xml ] ; then
33  echo ""
34  echo "Warning: Server returned zero sized file image_cbs_result.xml"
35  echo "         Check that the doc-id used is valid"
36  echo ""
37else
38  cat image_cbs_result.xml
39  echo ""
40  /bin/rm image_cbs_result.xml
41fi
42
Note: See TracBrowser for help on using the browser.