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

Last change on this file since 20989 was 20989, checked in by davidb, 14 years ago

Improved error reporting

File size: 884 bytes
RevLine 
[20983]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
[20989]27 echo ""
28 echo "Error: Failed to generate image_cbs_result.xml"
29 echo " Check catalina.out for server-side error messages"
30 echo ""
[20983]31 exit 1
[20989]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 ""
[20983]37else
38 cat image_cbs_result.xml
[20989]39 echo ""
[20983]40 /bin/rm image_cbs_result.xml
41fi
42
Note: See TracBrowser for help on using the repository browser.