Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nick Bearson
eodn2realearth
Commits
dfa887d7
Commit
dfa887d7
authored
Dec 24, 2015
by
Nick Bearson
Browse files
converting from wmsupload to reupload
parent
66675347
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/process-LCtgz.sh
View file @
dfa887d7
...
@@ -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
}
/
wms
upload
WMSUPLOAD
=
${
DIR
}
/
re_
upload
SCENE
=
$1
SCENE
=
$1
OPFLAG
=
${
2
:-
""
}
OPFLAG
=
${
2
:-
""
}
...
...
src/process-LCzip.sh
View file @
dfa887d7
...
@@ -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
}
/
wms
upload
WMSUPLOAD
=
${
DIR
}
/
re_
upload
SCENE
=
$1
SCENE
=
$1
log
"PROCESSING:
$1
"
log
"PROCESSING:
$1
"
...
...
src/
wms
upload
→
src/
re_
upload
View file @
dfa887d7
#!/bin/sh
#!/bin/sh
################################################################################
################################################################################
# DO NOT ALTER THIS LINE
# DO NOT ALTER THIS LINE
VERSION
=
1
5
VERSION
=
1
6
################################################################################
################################################################################
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
}
/
wms
upload"
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
}
/
wms
upload?name
=
${
WMS
_NAME
}
`
SERVER_DIRECT
=
`
${
CURL
}
-s
http://
${
SERVER
}
/
upload/re_
upload?name
=
${
RE
_NAME
}
`
else
else
SERVER_DIRECT
=
`
${
CURL
}
-s
http://
${
SERVER
}
/
wms
upload?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
}
/
wms
upload?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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment