SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Linux
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Linux Discussion related to the SageTV Media Center for Linux. Questions, issues, problems, suggestions, etc. relating to the SageTV Linux should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-10-2011, 08:08 PM
jbmia jbmia is offline
Sage User
 
Join Date: Apr 2009
Posts: 73
Tips on using Rsync to mirror video folders?

Hey guys,

Hoping some of you rsync experts can chime in on this one...

I've got 2 boxes, one with a shared folder with a directory of video files with which I'd like to copy entire folder structures of content over to a video share on another box. This would ordinarily look something like this...

"rsync -avzru /mnt/samba/videos 192.168.1.2:/mnt/samba/videos"

But, because the video folder on the first box contains some file types I don't want to copy over, I want to do something a bit different. What I'd like to be able to do is add a search argument that only copies those files and those folders structures that are or contain an "mkv" file in them...

So, if I have an xzy.mkv file thats new and not in the folder on machine 2, I want to copy that over. If have a folder titled abc, that contains a file named, abc.mkv, thats not on machine 2, I want to copy that whole folder structure over.

Any thoughts? I've used rsync a bit, but I'm not an expert. Hoping someone has some quick wisdom to share. I'd rather not experiment with these two folders...

Thanks!!

jbmia
Reply With Quote
  #2  
Old 02-13-2011, 07:21 AM
korstad korstad is offline
Sage User
 
Join Date: Aug 2007
Posts: 12
unison

I would look at unison.
http://www.cis.upenn.edu/~bcpierce/unison/


I have been using this for years and controlling it with several include, ignore, path statements in the .prf

You can have it sync the two side or use force option to have one side always win (mirror).

I use the batch option, ssh keys (no password prompt) or remote side with socket running and crontab to automate it..
Reply With Quote
  #3  
Old 02-13-2011, 08:50 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
rysnc has --include and --exclude filters... so you could use --include "*.mkv" to only sync mkv files or --exclude '*.properties' if you didn't want the .properties synced.

http://samba.anu.edu.au/ftp/rsync/rsync.html
Reply With Quote
  #4  
Old 02-13-2011, 07:16 PM
kbyrd kbyrd is offline
Sage Aficionado
 
Join Date: Sep 2008
Location: SF Bay Area, CA
Posts: 282
Quote:
Originally Posted by stuckless View Post
rysnc has --include and --exclude filters... so you could use --include "*.mkv" to only sync mkv files or --exclude '*.properties' if you didn't want the .properties synced.

http://samba.anu.edu.au/ftp/rsync/rsync.html
+1.

I use a set of shell scripts that do various invocations of rsync with --exclude, so I do things like backup videos, but not things that are in my temporary directories (m2ts files, or mkvs before subtitles are merged int"

Usually, my rsync looks something like this:
Code:
rsync -axvPS --exclude='sagetv/temp/' --exclude='sagetv/videos/*.m2ts' --delete --delete-excluded /mnt/storage /mnt/backups/2011.02.13/
Read the doc pages carefully. Trailing slashes change rsync's behavior. By doing --exclude='sagetv/temp/', the directory 'temp' is created but none of the contents are copied. When restoring from backup, it's useful to know what directories should be where.
__________________
Current Server: Sage v7.1.9.1 beta w/ Diamond UI on Ubuntu 11.10 x86_64 | Storage: Linux md's raid10,f2 | Client: HD300 extender | Tuner: HDHomeRun for QAM
Reply With Quote
  #5  
Old 02-20-2011, 10:04 AM
jbmia jbmia is offline
Sage User
 
Join Date: Apr 2009
Posts: 73
Thanks for the tips guys... Apologies for the late reply, I was out last week.

I'll check out Unison... but in the mean time, regarding rsync, I'm a bit confused on one point...

I'm good on the exclude examples and the trailing slashes.. those are pretty straight forward points..

I want to copy individual mkv files AND any folder structures that also include them... while at the same time excluding other file types... I get the exclude option, but how to copy my mkv files over while ALSO preserving any folder structures they exist in and copy them over within that path structure??

Thanks for any additional insight!

jbmia
Reply With Quote
  #6  
Old 02-21-2011, 08:55 AM
kbyrd kbyrd is offline
Sage Aficionado
 
Join Date: Sep 2008
Location: SF Bay Area, CA
Posts: 282
Code:
rsync -axvP --include='*/' --include='*.mkv' --exclude='*' /mnt/storage/sagetv/ /mnt/backups/
Although, once your exclude/include filters start getting like this, I would consider putting them in a file and having rsync read the file. Read the man page, specifically the section called "FILTER RULES". It addresses exactly what you need, although it provides a different way to do it than I did.
__________________
Current Server: Sage v7.1.9.1 beta w/ Diamond UI on Ubuntu 11.10 x86_64 | Storage: Linux md's raid10,f2 | Client: HD300 extender | Tuner: HDHomeRun for QAM
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to clear old SageMC video folders sportera SageMC Custom Interface 2 10-10-2010 04:05 PM
Separate Video Folders? sflamm SageMC Custom Interface 7 04-07-2009 07:04 PM
Watched Video Count for Video Folders jusjoken SageTV Customizations 0 08-02-2008 09:12 AM
Folders with Subfolders with Video igraul SageTV Software 2 02-13-2006 11:56 AM
Changing order of video folders Stuntman SageTV Customizations 1 08-26-2005 12:08 PM


All times are GMT -6. The time now is 07:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.