Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

copy a file slowly and catch an error when fails on unix

Posted on 2009-07-13
4
Medium Priority
?
241 Views
Last Modified: 2013-12-26
There is a production mainframe job that copy a file between 2AM to 2:30AM on Unix.  Sometimes, the job fails without giving out any error.  

I would like to mimic the copy to find out the error.  So, I am thinking to schedule a unix job to copy a small file ( or ftp a file or something similar) between 2AM to 2:30AM.  I don't want to copy a large file though for 30 minutes.  Is there a way to consistently copy a small file over and over again or copy a small file slowly?  What is the command to catch error message when error occurs?

Thanks.
0
Comment
Question by:ewang1205
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 1050 total points
ID: 24841080
if you copy file with command cp then you can always check command exit code:

cp file1 file2

if [ $? -EQ 0 ]
then
    echo successful
else
     echo there was an error
fi
0
 

Author Comment

by:ewang1205
ID: 24841123
Can I echo the error?  Thanks.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24841139
Well, if there is an error then the command / tool should produce the error message.
0
 
LVL 62

Assisted Solution

by:gheist
gheist earned 450 total points
ID: 24861075
> Can I echo the error?

echo $?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question