Commit dfa887d7 authored by Nick Bearson's avatar Nick Bearson
Browse files

converting from wmsupload to reupload

parent 66675347
...@@ -17,7 +17,7 @@ DIR="${BASH_SOURCE%/*}" ...@@ -17,7 +17,7 @@ DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/consts.sh" . "$DIR/consts.sh"
WMSUPLOAD=${DIR}/wmsupload WMSUPLOAD=${DIR}/re_upload
SCENE=$1 SCENE=$1
OPFLAG=${2:-""} OPFLAG=${2:-""}
......
...@@ -7,7 +7,7 @@ DIR="${BASH_SOURCE%/*}" ...@@ -7,7 +7,7 @@ DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/consts.sh" . "$DIR/consts.sh"
WMSUPLOAD=${DIR}/wmsupload WMSUPLOAD=${DIR}/re_upload
SCENE=$1 SCENE=$1
log "PROCESSING: $1" log "PROCESSING: $1"
......
#!/bin/sh #!/bin/sh
################################################################################ ################################################################################
# DO NOT ALTER THIS LINE # DO NOT ALTER THIS LINE
VERSION=15 VERSION=16
################################################################################ ################################################################################
SERVER=realearth.ssec.wisc.edu:80 SERVER=realearth.ssec.wisc.edu:80
...@@ -44,7 +44,7 @@ showHelp() { ...@@ -44,7 +44,7 @@ showHelp() {
} }
checkUpdate() { checkUpdate() {
DL_URL="http://${SERVER}/wmsupload" DL_URL="http://${SERVER}/upload/re_upload"
URL="$DL_URL?version=${VERSION}" URL="$DL_URL?version=${VERSION}"
VERSION_CHECK=`${CURL} -s ${URL}` VERSION_CHECK=`${CURL} -s ${URL}`
if [ -n "${VERSION_CHECK}" ]; then if [ -n "${VERSION_CHECK}" ]; then
...@@ -58,10 +58,10 @@ checkUpdate() { ...@@ -58,10 +58,10 @@ checkUpdate() {
} }
# Get the options from the command line # Get the options from the command line
WMS_FORCE=0 RE_FORCE=0
WMS_PART=0 RE_PART=0
WMS_PROXY=0 RE_PROXY=0
WMS_VERBOSE=0 RE_VERBOSE=0
if [ -z "$1" ]; then if [ -z "$1" ]; then
showHelp showHelp
exit 0 exit 0
...@@ -74,13 +74,13 @@ while getopts hufprvs: o; do ...@@ -74,13 +74,13 @@ while getopts hufprvs: o; do
u) checkUpdate u) checkUpdate
exit 0 exit 0
;; ;;
f) WMS_FORCE=1 f) RE_FORCE=1
;; ;;
p) WMS_PART=1 p) RE_PART=1
;; ;;
r) WMS_PROXY=1 r) RE_PROXY=1
;; ;;
v) WMS_VERBOSE=1 v) RE_VERBOSE=1
;; ;;
s) SERVER=${OPTARG} s) SERVER=${OPTARG}
;; ;;
...@@ -92,25 +92,25 @@ done ...@@ -92,25 +92,25 @@ done
shift $((${OPTIND} -1)) shift $((${OPTIND} -1))
# Set our variables # Set our variables
WMS_FILE=$1 RE_FILE=$1
WMS_NAME=$2 RE_NAME=$2
WMS_DATE=$3 RE_DATE=$3
WMS_TIME=$4 RE_TIME=$4
# Does the file exist? # Does the file exist?
if [ ! -f "${WMS_FILE}" ]; then if [ ! -f "${RE_FILE}" ]; then
echo "ERROR: Could not find file: ${WMS_FILE}" echo "ERROR: Could not find file: ${RE_FILE}"
exit 1 exit 1
fi fi
# Set the defaults for sending # Set the defaults for sending
WMS_FILE_DIR=`dirname "${WMS_FILE}"` RE_FILE_DIR=`dirname "${RE_FILE}"`
WMS_FILE_NAME=`basename "${WMS_FILE}"` RE_FILE_NAME=`basename "${RE_FILE}"`
# Verify the product name # Verify the product name
if [ -n "${WMS_NAME}" ]; then if [ -n "${RE_NAME}" ]; then
match=`expr "${WMS_NAME}" : '\([a-zA-Z0-9\-]\{1,\}\)'` match=`expr "${RE_NAME}" : '\([a-zA-Z0-9\-]\{1,\}\)'`
if [ "$match" != "${WMS_NAME}" ]; then if [ "$match" != "${RE_NAME}" ]; then
echo "" echo ""
echo "ERROR: Invalid product name" echo "ERROR: Invalid product name"
showHelp showHelp
...@@ -119,9 +119,9 @@ if [ -n "${WMS_NAME}" ]; then ...@@ -119,9 +119,9 @@ if [ -n "${WMS_NAME}" ]; then
fi fi
# Verify the product date # Verify the product date
if [ -n "${WMS_DATE}" ]; then if [ -n "${RE_DATE}" ]; then
match=`expr "${WMS_DATE}" : '\([0-9]\{8\}\)'` match=`expr "${RE_DATE}" : '\([0-9]\{8\}\)'`
if [ "$match" != "${WMS_DATE}" ]; then if [ "$match" != "${RE_DATE}" ]; then
echo "" echo ""
echo "ERROR: Invalid product date" echo "ERROR: Invalid product date"
showHelp showHelp
...@@ -130,9 +130,9 @@ if [ -n "${WMS_DATE}" ]; then ...@@ -130,9 +130,9 @@ if [ -n "${WMS_DATE}" ]; then
fi fi
# Verify the product time # Verify the product time
if [ -n "${WMS_TIME}" ]; then if [ -n "${RE_TIME}" ]; then
match=`expr "${WMS_TIME}" : '\([0-9]\{6\}\)'` match=`expr "${RE_TIME}" : '\([0-9]\{6\}\)'`
if [ "$match" != "${WMS_TIME}" ]; then if [ "$match" != "${RE_TIME}" ]; then
echo "" echo ""
echo "ERROR: Invalid product time" echo "ERROR: Invalid product time"
showHelp showHelp
...@@ -141,32 +141,32 @@ if [ -n "${WMS_TIME}" ]; then ...@@ -141,32 +141,32 @@ if [ -n "${WMS_TIME}" ]; then
fi fi
# Get the direct upload name (unless -r was specified) # Get the direct upload name (unless -r was specified)
if [ ${WMS_PROXY} -eq 0 ]; then if [ ${RE_PROXY} -eq 0 ]; then
SERVER_DIRECT= SERVER_DIRECT=
if [ -n "${WMS_NAME}" ]; then if [ -n "${RE_NAME}" ]; then
SERVER_DIRECT=`${CURL} -s http://${SERVER}/wmsupload?name=${WMS_NAME}` SERVER_DIRECT=`${CURL} -s http://${SERVER}/upload/re_upload?name=${RE_NAME}`
else else
SERVER_DIRECT=`${CURL} -s http://${SERVER}/wmsupload?file=${WMS_FILE_NAME}` SERVER_DIRECT=`${CURL} -s http://${SERVER}/upload/re_upload?file=${RE_FILE_NAME}`
fi fi
if [ -n "${SERVER_DIRECT}" ]; then if [ -n "${SERVER_DIRECT}" ]; then
SERVER=${SERVER_DIRECT} SERVER=${SERVER_DIRECT}
else else
if [ ${WMS_VERBOSE} -ne 0 ]; then if [ ${RE_VERBOSE} -ne 0 ]; then
echo "WARNING: Could not determine the head node URL for proxy upload" echo "WARNING: Could not determine the head node URL for proxy upload"
fi fi
fi fi
fi fi
# Change to the dir with the file # Change to the dir with the file
cd "${WMS_FILE_DIR}" cd "${RE_FILE_DIR}"
echo "Connecting to ${SERVER}..." echo "Connecting to ${SERVER}..."
# Check if the server is ready to receive the file # Check if the server is ready to receive the file
if [ ${WMS_VERBOSE} -ne 0 ]; then if [ ${RE_VERBOSE} -ne 0 ]; then
echo "Checking upload availability" echo "Checking upload availability"
fi fi
BYTES=`/bin/ls -Lln "${WMS_FILE_NAME}" |awk '{print $5}'` BYTES=`/bin/ls -Lln "${RE_FILE_NAME}" |awk '{print $5}'`
COMMAND="${CURL} -s http://${SERVER}/wmsupload?bytes=${BYTES}" COMMAND="${CURL} -s http://${SERVER}/upload/re_upload?bytes=${BYTES}"
SUCCESS=`${COMMAND} -o - 2>/dev/null |head -1` SUCCESS=`${COMMAND} -o - 2>/dev/null |head -1`
if [ "${SUCCESS}" -eq "${SUCCESS}" ] 2>/dev/null; then if [ "${SUCCESS}" -eq "${SUCCESS}" ] 2>/dev/null; then
if [ "${SUCCESS}" = "-1" ]; then if [ "${SUCCESS}" = "-1" ]; then
...@@ -179,27 +179,27 @@ if [ "${SUCCESS}" -eq "${SUCCESS}" ] 2>/dev/null; then ...@@ -179,27 +179,27 @@ if [ "${SUCCESS}" -eq "${SUCCESS}" ] 2>/dev/null; then
SUCCESS=`${COMMAND} -o - |head -1` SUCCESS=`${COMMAND} -o - |head -1`
done done
else else
if [ ${WMS_VERBOSE} -ne 0 ]; then if [ ${RE_VERBOSE} -ne 0 ]; then
echo " Server does not understand file size check, continuing..." echo " Server does not understand file size check, continuing..."
fi fi
fi fi
# Send the file # Send the file
echo "Sending ${WMS_FILE_NAME}" echo "Sending ${RE_FILE_NAME}"
COMMAND="${TIMEOUT} ${CURL} --max-time 600 -s http://${SERVER}/upload/ -F file=@${WMS_FILE_NAME}" COMMAND="${TIMEOUT} ${CURL} --max-time 600 -s http://${SERVER}/upload/ -F file=@${RE_FILE_NAME}"
if [ -n "${WMS_NAME}" ]; then if [ -n "${RE_NAME}" ]; then
COMMAND="${COMMAND} -F name=${WMS_NAME}" COMMAND="${COMMAND} -F name=${RE_NAME}"
fi fi
if [ -n "${WMS_DATE}" ]; then if [ -n "${RE_DATE}" ]; then
COMMAND="${COMMAND} -F date=${WMS_DATE}" COMMAND="${COMMAND} -F date=${RE_DATE}"
fi fi
if [ -n "${WMS_TIME}" ]; then if [ -n "${RE_TIME}" ]; then
COMMAND="${COMMAND} -F time=${WMS_TIME}" COMMAND="${COMMAND} -F time=${RE_TIME}"
fi fi
if [ ${WMS_PART} -ne 0 ]; then if [ ${RE_PART} -ne 0 ]; then
COMMAND="${COMMAND} -F part=1" COMMAND="${COMMAND} -F part=1"
fi fi
if [ ${WMS_FORCE} -ne 0 ]; then if [ ${RE_FORCE} -ne 0 ]; then
COMMAND="${COMMAND} -F force=1" COMMAND="${COMMAND} -F force=1"
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment