LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 02-03-2013, 03:27 AM   #1
waddles
Member
 
Registered: Sep 2012
Posts: 372

Rep: Reputation: 1
Archiving via rsync via shell script


I am attempting to contrive a shell script which will allow me to to use rsync and backup only about 6 directories to a DVD or pair of CDs.
1) am I correct in thinking that rsync is designed primarily to collect all directories then exclude until one has the directories of interest or is there a more direct approach?
2) when archiving to a DVD/CD can one put rsync in a for loop and specify the directory to collect files from one at a time and still be writing to the same device (I hope to devise a means of pausing and inserting an n-th CD unless that is known to be difficult)?
This is for Slackware 13.37 desktop.
 
Old 02-04-2013, 10:14 AM   #2
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,159

Rep: Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364
I think rsync cannot split data and wait for the next CD, but tar can handle devices.
 
1 members found this post helpful.
Old 02-04-2013, 10:33 AM   #3
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 15,098

Rep: Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719
Quote:
Originally Posted by waddles View Post
I am attempting to contrive a shell script which will allow me to to use rsync and backup only about 6 directories to a DVD or pair of CDs.
1) am I correct in thinking that rsync is designed primarily to collect all directories then exclude until one has the directories of interest or is there a more direct approach?
2) when archiving to a DVD/CD can one put rsync in a for loop and specify the directory to collect files from one at a time and still be writing to the same device (I hope to devise a means of pausing and inserting an n-th CD unless that is known to be difficult)?
This is for Slackware 13.37 desktop.
Never tired to do anything like that with rsync, but have done something similar using scp.

I did the whole copy first to a single directory on my receiving system, then my script would go through and make a sub-directory, and only move 640MB of data from the parent into it; If the next file to be moved would put it over 640MB, then a new subdir would be made, and the file put there. I was left with one directory, which had sub-directories in it, labeled disc1, disc2, etc. Each the size of a CDROM, ready to burn. That may be easier than trying to figure out how much data is rsync is handling on the fly. Just a suggestion.
 
1 members found this post helpful.
Old 02-04-2013, 05:33 PM   #4
dilbert_uk
Member
 
Registered: Aug 2011
Location: Yorkshire (UK)
Distribution: Lubuntu 10.04, Puppy Wary 5.1.2
Posts: 45

Rep: Reputation: Disabled
rsync is very complex and has a typical manpage very difficult to understand. I spent some time reading the manpage and examples from the Web to exclude directories but there is also an "include" feature.

I use rsync from within my bash_aliases file with an rsync-filter file:

Code:
dilbert@sempron:~$ cat .bash_aliases 
[...]
alias rs='rsync -av --exclude-from=$HOME/.rsync-filter /home/dilbert/ /media/FreeAgent_GoFlex_Drive/dilbert/'
dilbert@sempron:~$ cat .rsync-filter 
#
# A standard filter file for rsync.
#
# Use it to add include/exclude patterns for the backup script. See sections
# "FILTER RULES" and "INCLUDE/EXCLUDE PATTERN RULES" in rsync's man page for
# more information. Patterns starting with / are anchored like with ^ in
# regular expressions.
#
# Usage: rsync --filter="merge /path/to/this/file".
#

# Universal excludes -- These apply to all subdirs
- [Cc]ache/
 
# Exclude certain directories
 
# Anything in Downloads can be downloaded again, so don't save it
- /.thumbnails/normal/
 
# These are too big to include
 
# These are transient
- /.local/share/Trash/
- /.cache/
 
# Misc files/dirs to exclude
- /.macromedia/
- /.Trash/
- /.xsession-errors*

# EOF
dilbert@sempron:~$

Last edited by dilbert_uk; 02-04-2013 at 05:39 PM. Reason: code tags
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script, rsync wrapper, space in path ezekieldas Linux - Software 6 02-21-2012 06:52 PM
Is my shell script that has rsync in it working? Cyberman Programming 4 08-31-2010 06:39 AM
[SOLVED] shell script wrapper for automating rsync someshpr Linux - Newbie 3 06-03-2010 02:31 AM
python rsync script runs from shell not from cron beanbox Programming 3 11-18-2009 07:23 PM
local rsync shell script eradrix Programming 13 07-09-2005 01:57 AM


All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration