|
Move Command and exit status problem
Hi All,
I am using the following code to move files from one folder to another on the remote server:
ssh username@server <<EOF
cd source_dir
find . -type f -name "*.txt" |xargs -n1000 -i{} mv {} dest_dir
if [$? !=0]
then send mail indicating error
otherwise
echo "success"
fi
EOF
Now,when i do the manual run of the script it works fine but when schedule run of the script takes place it send the mail to me indicating that some error has occured(though dont' know the exact error).
Could someone tell me why is this happening.Moreover, how can i track down the exact error message while the schedule run of the script is taking place.
|