The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
rsync: taking advantage of files in different directory other than destination rssrik UNIX for Advanced & Expert Users 1 05-06-2008 04:35 AM
Getting a list of filenames of moved files chengwei Shell Programming and Scripting 3 04-23-2007 12:25 AM
rsync not copying all files from smb-mounted fs fishsponge UNIX for Advanced & Expert Users 2 10-04-2005 12:40 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-10-2008
JCR JCR is offline
Registered User
 

Join Date: Jan 2007
Posts: 29
Stumble this Post!
rsync, which files where moved?

Hello,
I am using rsync to make sure that my folder "local" mirrors the remote directory "remote". When a file is copied from "remote" to "local", I need to apply a bash script to it. What would be a neat way to do that?

Thanks

ps: is there a way to edit the title of the thread (I am a bit ashamed of the "where" instead of "were"?

Last edited by JCR; 02-10-2008 at 08:20 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-10-2008
HPAVC's Avatar
Registered User
 

Join Date: Feb 2008
Posts: 105
Stumble this Post!
Ok, I follow you right, you want to mirror all the files from remote to local (not sure if changes to local need to go remote though). After you rsync you want to (do something) to all the files individually that had been changed (lets say perhaps you want to dos2unix them). Well obviously after you dos2unix them, and you run rsync again your going to mirror all those files again since you changed them which is a problem.

Assuming you know this and are copying the files elsewhere after being proicessed, rather that using rsync's --out-format or --log-format and then grinding on that you can simply something akin to this, as long as the timestamps aren't being copied over and your just using size/crc to do the mirror.

touch TEMPFILE
rsync --opts SOURCE TARGET
find TARGET -type f --newer TEMPFILE --exec BASHSCRIPT "{}" ";"
rm TEMPFILE
Reply With Quote
  #3 (permalink)  
Old 02-10-2008
Registered User
 

Join Date: Feb 2008
Location: Chennai
Posts: 2
Stumble this Post!
Post Copying files to remote machine using rsync

sciprtfile | tee filename.log

this will copy the output into a file

or

scriptfile | mail -s "backup files" user@domain.com

Last edited by balapobi; 02-10-2008 at 10:55 AM.
Reply With Quote
  #4 (permalink)  
Old 02-10-2008
HPAVC's Avatar
Registered User
 

Join Date: Feb 2008
Posts: 105
Stumble this Post!
Quote:
Originally Posted by balapobi View Post
Hi there is an another script, create a ssh-key and import that key in remote machine, run this script in local machine. Your files get copied in remote machine.

$RSYNC -az -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH $LPATH

run this script...
Copying doesn't seem to be the issue, processing the changes is.
Reply With Quote
  #5 (permalink)  
Old 02-11-2008
JCR JCR is offline
Registered User
 

Join Date: Jan 2007
Posts: 29
Stumble this Post!
HPAVC,

Thanks for the idea. I added a sleep 1 between the creation of the temp file and the rsync call because it seems to me that the -newer means strictly newer.
Reply With Quote
  #6 (permalink)  
Old 02-11-2008
HPAVC's Avatar
Registered User
 

Join Date: Feb 2008
Posts: 105
Stumble this Post!
Quote:
Originally Posted by JCR View Post
HPAVC,

Thanks for the idea. I added a sleep 1 between the creation of the temp file and the rsync call because it seems to me that the -newer means strictly newer.
Yeah, the find syntax and my tired mind was probably an issue too.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:31 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0