#!/bin/bash
# Setup Variables
hostName=localhost
portNum=8080
SOLRPATH=/solr
SOLR='delta-import&clean=false'
STATUS='dataimport?command=status'
urlCmd='http://${hostName}:${portNum}${SOLRPATH}/dataimport?command=${SOLRCMD}"
statusCmd='http://${hostName}:${portNum}${SOLRPATH}/dataimport?command=${STATUS}"
myStdErrLog=/tmp/myProject/myProg.stderr.$(/bin/date +%Y%m%d.%H%M)
outputDir=.
# Operations
wget -O $outputDir/check_status_update_index.txt ${statusCmd} 2> ${myStdErrLog}
status=$(fgrep idle $outputDir/check_status_update_index.txt)
case "${status}" in
*idle* ) .... ;;
* ) echo "unknown status = ${status} or similar" 1>&2 ;;
esac
All I really understand is that we get urlcmd and statuscmd built up from the varialbes, but I dont understand what the operation does. Can anyone shed some light?
First there are bugs in the lines
Since they end with double quotes and include variables, they need to start with double quotes as well.
Variable
urlCmdis never used. Not a bug, but it isn’t nice either.wgetretrieves the status via thestatusCmdandfgreptries to extract the status. This status is then evaluated in the case statement.