home *** CD-ROM | disk | FTP | other *** search
/ The UNIX CD Bookshelf / OREILLY_TUCB_UNIX_CD.iso / run_me.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1998-10-15  |  2KB  |  79 lines

  1. #!/bin/sh
  2. # run_me.sh
  3. #    runs Innotech's search server with a configuration file in
  4. #    /tmp/netresults
  5. # run_me.sh tempdir
  6. #    will run the server with a configuration file in
  7. #    tempdir/netresults
  8.  
  9. # Find the Java interpreter
  10. if [ $JRE"X" = "X" ]
  11. then
  12.     if [ -x `which jre` ]
  13.     then
  14.     JRE=`which jre`
  15.     elif [ -x `which java` ]
  16.     then
  17.     JRE=`which java`
  18.     else
  19.     echo "There is no Java interpreter in your executable search path.  Please"
  20.     echo "make sure you have an interpreter (such as \"jre\" or \"java\") installed."
  21.     echo "Then make sure that the executable is in your path, or set the JRE"
  22.     echo "environment variable to point to it."
  23.     exit 1
  24.     fi
  25. elif [ ! -x $JRE ]
  26. then
  27.     echo "You have set the JRE environment variable, but the file it points to"
  28.     echo "is not an executable.  Please unset the variable, or verify that it"
  29.     echo "points to your executable Java interpreter."
  30.     exit 1
  31. fi
  32.  
  33. if [ ! \( $1"X" = "X" -o -d "$1" \) ]
  34. then
  35.     echo "Usage:"
  36.     echo "$0"
  37.     echo "   will run the server with a configuration file in"
  38.     echo "   /tmp/netresults"
  39.     echo "$0 tempdir"
  40.     echo "   will run the server with a configuration file in"
  41.     echo "   tempdir/netresults"
  42.     exit 2
  43. fi
  44.  
  45. # The first parameter, if specified, should be the temporary
  46. # directory.
  47.  
  48. if [ $1"X" = "X" ]
  49. then
  50.     tempdir="/tmp"
  51. else
  52.     tempdir=$1
  53. fi
  54.  
  55. # If the NetResults directory has been created, we check for the
  56. # HTTP-based configuration file.
  57.  
  58. if [ -d $tempdir"/netresults" ]
  59. then
  60.  
  61.     # If the HTTP-based configuration file doesn't exist, create it.
  62.  
  63.     if [ ! -f $tempdir"/netresults/lynx-nr.cfg" ]
  64.     then
  65.     sed "s/^\(NO_RESULT_URL.*STRING \)[^ ]*/\1http:\/\/localhost:6016\/noResults.html/; s/^\(TEMP_HTML_URL.*STRING \)[^ ]*/\1http:\/\/localhost:6016\//" < $tempdir"/netresults/Server.cfg" > $tempdir"/netresults/http-nr.cfg"
  66.     fi
  67.  
  68.     # Run the server with the HTTP config file.
  69.  
  70.     cd netresults
  71.     $JRE -cp . -mx16m -ms8m itm.nr.serve.NRServer +prop=$tempdir"/netresults/http-nr.cfg"
  72. else
  73.     # Run the server with the default file.
  74.  
  75.     cd netresults
  76.     $JRE -cp . -mx16m -ms8m itm.nr.serve.NRServer
  77. fi
  78.  
  79.