Unix iTOps Tube

Wednesday, May 2, 2012

Weird Error moving a file

Hi,

We are running into very weird error on AIX. Target directory exists on NFS.



We have one script runs every 5 mins on our system. This script is running for 5 years for now without any issuess.



Followig is the snapshot of the script :




Code:


  stmt_cnt=$(ls -1 ${1}/${2}|wc -l)

  if [ ${stmt_cnt} -ne 0 -a ${stmt_cnt} -lt 501 ]; then

    out_str="${out_str}\n$(date +"%Y%m%d%H%M%S"): Moving ${stmt_cnt} \"${2}\" statements from ${1} to ${3}\n"

    find ${1} -name "${2}" | sort -t"_" +7n +8n | xargs ksh -c 'mv $* '"${3}" foobar


Recently, mv command started failing only few occasions. Intrestingly, it is successful in the second run after failing in first run.



Following is the Error.




Code:


Usage: mv [-I] [ -d| -e] [-i | -f] [-E{force|ignore|warn}] [--] src target

  or: mv [-I] [-i | -f] [-E{force|ignore|warn}] [--] src1 ... srcN directory


Any guesses ? Appreciate pointers.




No comments:

Post a Comment