Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> rsync includes/excludes issues
slepmog
post Dec 7 2007, 06:07 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 7-December 07
Member No.: 13,186



hi guys, new to the forums but reasonably experienced with linux.

I'm trying to backup files from a directory which has subdirs named with the date in the format YYYYMMDD to an rsync server on an hourly cron job. There are lots of subdirs but i only want the past weeks worth. The way i'm trying to do this is building an rsync includes file with the directories i want and excluding everything else.

#/bin/sh
date +20%y%m%d"/" -d '7 days ago' > rsync-includes
date +20%y%m%d"/" -d '6 days ago' >> rsync-includes
date +20%y%m%d"/" -d '5 days ago' >> rsync-includes
date +20%y%m%d"/" -d '4 days ago' >> rsync-includes
date +20%y%m%d"/" -d '3 days ago' >> rsync-includes
date +20%y%m%d"/" -d '2 days ago' >> rsync-includes
date +20%y%m%d"/" -d 'yesterday' >> rsync-includes
date +20%y%m%d"/" >> rsync-includes
rsync -av --include='*/' --include-from=rsync-includes --exclude='*' --delete `pwd` rsync://server/profile

This results in transferring no files. the result of cat rsync-includes is:
20071130/
20071201/
20071202/
20071203/
20071204/
20071205/
20071206/
20071207/

TIA smile.gif
Go to the top of the page
 
+Quote Post
slepmog
post Dec 7 2007, 07:13 AM
Post #2


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 7-December 07
Member No.: 13,186



i have since upgraded to the newest version of rsync and an now using this script:
CODE
#/bin/sh
echo + `pwd`/`date +20%y%m%d"/" -d '7 days ago'` > .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '6 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '5 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '4 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '3 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '2 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d 'yesterday'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d`"/" >> .rsync-filter
echo "- *" >> .rsync-filter
rsync -anvz  --filter=".rsync-filter" --delete `pwd` rsync://server4/voip


which gies a .rsync-filter file of:
CODE
+ /var/www/html/recordings/calls/20071130/
+ /var/www/html/recordings/calls/20071201/
+ /var/www/html/recordings/calls/20071202/
+ /var/www/html/recordings/calls/20071203/
+ /var/www/html/recordings/calls/20071204/
+ /var/www/html/recordings/calls/20071205/
+ /var/www/html/recordings/calls/20071206/
+ /var/www/html/recordings/calls/20071207/
- *

which according to the rsync man file, should be valid. alas i get an error of
CODE
[root@asterisk1 calls]# ./backup.sh
invalid modifier sequence at 'y' in filter rule: .rsync-filter
rsync error: syntax or usage error (code 1) at exclude.c(781) [client=2.6.8]


grr...
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th October 2017 - 03:44 PM