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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-12-2014, 09:22 PM
|
#1
|
Member
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586
Rep:
|
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
|
|
|
05-12-2014, 09:27 PM
|
#2
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
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.
|
|
|
05-12-2014, 10:23 PM
|
#3
|
Member
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586
Original Poster
Rep:
|
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.
|
05-13-2014, 12:35 AM
|
#4
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
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.
|
|
|
05-15-2014, 12:02 PM
|
#5
|
Member
Registered: Sep 2005
Distribution: Arch
Posts: 210
Rep:
|
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.
|
|
|
05-15-2014, 08:13 PM
|
#6
|
Member
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 05:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|