What you have posted as material for troubleshooting is very ambiguous and your confirmation that tempFDMEE.csv exists doesn't help, since you did not post any result or output that really confirms it.
That said, here some tips that you may choose to put in practice.
Add set -xv
somewhere in the beginning of the script to help you debug
I do not know why you commented this line:
# ./epmautomate.sh downloadfile ${_DATAMGMT_BIN}/${_TEMPFILE} > /dev/null
and not the following, expecting something meaningful of it
if [ "$_RVAL" -eq "0" ]
then
echo && echo "Successful : Download Data File"
else
echo && echo "Failed : Download Data File"
fi
Back again to the following line but without comment and assuming that is free of issues
./epmautomate.sh downloadfile ${_DATAMGMT_BIN}/${_TEMPFILE} > /dev/null
Redirecting the stdout to oblivion doesn't very robust. Is there a possibility that the output is the content of the download? Who knows?
./epmauthomate.sh should send information and status of the running of program, including warnings and errors to stderr. In that way you may be able to ignore it if you choose it as 2> /dev/null
Concerning:
if [ "$_RVAL" -eq "0" ]
The return of the previous command with a zero, in this case is not a guarantee the veracity of the echo statement:
echo "Successful : Download Data File"
Depending how it was written ./epmauthomate.sh could and will return a zero even when the result was not a successful download but rather a clean exist.
Perhaps something like this would be more ensuring
if [ "$_RVAL" -eq "0" ] && [ -e "${_TEMPFILE}" ]
then
echo && echo "Successful : Download Data File"
else
echo && echo "Failed : Download Data File"
fi
The &&
is superfluous or without purpose.
Consider this:
then
echo
echo "Successful : Download Data File"
else
echo
echo "Failed : Download Data File"
What's the problem with this?
mv "${_TEMPFILE}" "${_INBOXPATH}${_FILE}"
As shown, it does regardless if the file exist or was downloaded successfully, despise of the claim to the contrary.
[ -e "${_TEMPFILE}" ] && mv "${_TEMPFILE}" "${_INBOXPATH}${_FILE}"
would test before trying to mv
.
Some possible changes, then, assuming that ${_FILE}
has a proper value.
echo ---------------------------------------------------------
echo "Download Data File"
echo ---------------------------------------------------------
echo "Action : downloadfile"
echo "Data File : ${_TEMPFILE}"
echo ---------------------------------------------------------
pushd "${_EPMAUTOMATE_BIN}"
./epmautomate.sh downloadfile ${_DATAMGMT_BIN}/${_TEMPFILE} 2> /dev/null
_RVAL="$?"
if [ "$_RVAL" -eq "0" ] && [ -e "${_TEMPFILE}" ]
then
echo
echo "Successful : Download Data File"
mkdir -p "${_INBOXPATH}"
mv "${_TEMPFILE}" "${_INBOXPATH}${_FILE}"
else
echo
echo "Failed : Download Data File"
fi
popd
------ Post updated at 09:56 AM ------
Good catch but it doesn't explain the output:
mv: cannot stat `tempFDMEE.csv': No such file or directory
If the file tempFDMEE.csv
exists
mv "${_TEMPFILE}" "{_INBOXPATH}${_FILE}"
It would rename tempFDMEE.csv
literately {_INBOXPATH}whatever_${_FILE}_has_or_nothing
in the current directory