LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-12-2014, 09:22 PM   #1
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Rep: Reputation: 38
rsync backup script not working


I am using this for my rsync backup script:

Quote:
#!/bin/bash

# Flash backup script


#The source directory:
SRC="/home/joe/"

#The target directory:
TRG="/media/linux/joe/"

#The rsync options:
OPT=(-amv --numeric-ids --delete --delete-excluded --filter="merge /home/joe/bin/scripts/flash-filter-rule.txt")

#Execute the backup
rsync $OPT $SRC $TRG
Quote:
Filter file
- /audio/
- /videos/
- /.cache/
- /.gvfs/
The options are being ignored. rsync is copying files over that are excluded. I think it is the quotes or () in OPT, but I don't know how to fix it. I first tried double quotes, but got errors.

Thanks
 
Old 05-12-2014, 09:27 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
Hi,

why are you using ( and ) in your OPT variable? Does is work if you use the following?
Code:
OPT="-amv --numeric-ids --delete --delete-excluded --filter='merge /home/joe/bin/scripts/flash-filter-rule.txt'"
Evo2.
 
Old 05-12-2014, 10:23 PM   #3
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Original Poster
Rep: Reputation: 38
I was just trying things.
The OPT you used gave me this error:
Quote:
Unknown filter rule: `'merge'
rsync error: syntax or usage error (code 1) at exclude.c(817) [client=3.0.9]
 
1 members found this post helpful.
Old 05-13-2014, 12:35 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
Hi,

according to the man page on my machine merge is a valid filter rule. Can you check your rsync man page?

Also, to simplify things, first try to get it working as a single command on the command line instead of in a script with intermidate variables. Once it is working on the commandline, you can put it into a script.

Evo2.
 
Old 05-15-2014, 12:02 PM   #5
Tadaen
Member
 
Registered: Sep 2005
Distribution: Arch
Posts: 210

Rep: Reputation: 39
I can't help but thank you for the post. I never considered making the options to a command as a variable. I've got a backup script that has the same rsync line twice when I could just use a variable... +1

Last edited by Tadaen; 05-15-2014 at 12:03 PM.
 
Old 05-15-2014, 08:13 PM   #6
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Original Poster
Rep: Reputation: 38
I got the idea from this page:
http://webgnuru.com/linux/rsync_incremental.php
but I don't know how to add the merge filter into the OPT

Last edited by JosephS; 05-15-2014 at 08:15 PM.
 
  


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
Configure Rsync script for backup mokapoor Linux - Newbie 6 11-11-2013 10:36 AM
rsync backup script help henryyy Linux - Newbie 7 03-05-2013 02:31 PM
rdiff-backup not working, but rsync is,Mandriva for both OS mattisdada Linux - Software 1 06-24-2012 11:38 PM
rsync in a backup script doesn't delete-after j1alu Programming 6 10-06-2010 11:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:00 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
Open Source Consulting | Domain Registration