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
please help in rsync naree SUN Solaris 10 1 Week Ago 04:34 AM
rsync vs cp jsy UNIX for Dummies Questions & Answers 1 03-24-2008 12:51 PM
rsync over ftp Hitori UNIX for Advanced & Expert Users 2 03-14-2008 09:42 AM
rsync in ftp Euler04 Shell Programming and Scripting 5 10-24-2005 04:17 AM
Rsync darknite87 UNIX for Advanced & Expert Users 1 06-06-2002 12:37 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-01-2001
Registered User
 

Join Date: Aug 2001
Posts: 4
Stumble this Post!
Question rsync

I want to do rsync only for the difference in the last 30 days. How do I specify the "30 days" on the command line below?

>rsync -avz prj# /rsource /destination


Thanks for help
Forum Sponsor
  #2 (permalink)  
Old 09-01-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
Stumble this Post!
from what I understand,
"rsync -avz prj# /rsource /destination" performs
the update of the differences. If this is so,
why not just run this from cron every 30 days?
  #3 (permalink)  
Old 09-01-2001
Registered User
 

Join Date: Aug 2001
Posts: 4
Stumble this Post!
Thanks for your cron job suggestion, rwb1959. I just wonder if this is just a one time job, what I should do? How do I specify the number of days, weeks, or months?
  #4 (permalink)  
Old 09-02-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
Stumble this Post!
crontab

First thing you want to do is check out the
man page for the command crontab(1) and the
file format for crontab(5).
You need to edit the user's (say Joe) crontab by:

crontab -u joe -e

...the make your entry. By the way, the editor
will be either "vi" or whatever you EDITOR
env. variable is set to. The man page for the
file format should show you exactly how to make
an entry to get what you want (I don't want to
give it away ) and you save it.

just an example:

# run at 10 pm on weekdays, annoy Joe
0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%HI JOE!!!%
  #5 (permalink)  
Old 09-04-2001
Registered User
 

Join Date: Aug 2001
Posts: 4
Stumble this Post!
Wink

Thanks for your great help ! Besides cronjob can you do a script and put the time range somewhere on the command line?
  #6 (permalink)  
Old 09-04-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
Stumble this Post!
Well, I'm not an rsync guru, and I don't see
(from the man page) any way to specify
a time range to rsync. If you wanted, you could
generate a specific list of files to sync to
the remote. You could create a script that uses
the "find" command using the -mtime option to
determine what files have been modified within
a given number of days and output this to a file
then use this file as a list of files to "sync".
As far as scheduling jobs however, cron is
"THE" scheduling program for UNIX. For instance,
you could execute the shell script that "looks"
for files modified in the last 30 days then have
the script run rsync.
  #7 (permalink)  
Old 09-04-2001
Registered User
 

Join Date: Aug 2001
Posts: 4
Stumble this Post!
Smile

Many thanks, rwb1959.

I set a simple script for one time rsync:

#!/bin/sh
date
/usr/local/bin/rsync -avz /rsource /destination
date
# --end of script--

I also setup a cron schedule for byweekly rsync jobs:

0 22 1,16 * * /usr/local/bin/rsync -avz /rsource /destination

I did some tests. Both worked very well. Thanks again!

wz253
Google The UNIX and Linux Forums
Closed Thread

Tags
mtime

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:15 PM.


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