Customizing STDERR redirection to a file
Hi,
I'm trying to create a small shell script that will use the rsync command to synchronize 2 directories and also will log to a file the success or not of the command and to another file the errors (not active network connection, etc). I'm stuck with the 2nd file, where I want to have the date and in a new line the output of standard error. So far, I've done something like this: Code:
if (rsync source destination) 2> /home/user/errors |
Quote:
Code:
~ $mkdir j |
Assuming I understand you correctly, after the echo, just do this:
Code:
cat /home/user/errors >> /home/user/status You might also have a look at the unison file synchronizer: http://www.cis.upenn.edu/~bcpierce/unison/ PS: $(..) is highly recommended over `..`. |
Thank you for your answers!
I've already managed to what you're proposing. What I need in the end are two files: 1) status: this should contain the date and the status of the last operation, e.g. 28/12/2011 - Success or 28/12/2011 - Failure 2) errors: this should contain the date and the error, in case there is one, e.g. 28/12/2011 - rsync: file not found (or something like this) |
All times are GMT -5. The time now is 01:37 AM. |