rsync help - include / exclude / delete - rsync

I have one large folder of movies I want to sync across to local drives (for backup)
/mnt/user/Movies contains folders with each movie and metadata.
For example:
/mnt/user/Movies/The_Godfather/The_Godfather.mkv
/mnt/user/Movies/The_Godfather/The_Godfather.srt
etc.
I want to sync to two drives -
/mnt/disks/disk1
/mnt/disks/disk2
I need to split up the large folder into two, and I've chosen to do it by letter. So, A-H on one drive and everything else on the other. "Everything else" will include I-Z, 0-9, and other characters (e.g., [rec]).
I would like the destination to always exactly mirror the source. So, delete files on destination not found on source.
I will run the scripts once a week or so - it's not that critical, once the initial backup has been made.
I've tried this:
rsync -rltzuvhm --delete --exclude="[H-Z]*" --exclude="*" --delete-excluded /mnt/user/Movies/ /mnt/disks/disk1/
rsync -rltzuvhm --delete --include="[H-Z]*" --exclude="*" --delete-excluded /mnt/user/Movies/ /mnt/disks/disk2
A few problems. For some reason, some files are not getting copied over. It doesn't seem to be recursing correctly or consistently.
Second (probably also related to recursion), after the first backup, the delete command tried to delete all of the subfolders (e.g. /mnt/disks/disk1/The_Godfather/Extras/)
I don't fully grasp the include/exclude modifiers - maybe there is something about the order in which I use them.
Thank you for the help.

Related

I have Advagg Module for Drupal 7.x and i have many files in folders advagg_js/css.... why?

I have Drupal 7.x and Advanced CSS/JS Aggregation 7.x-2.7
In folders advagg_js and advagg_css (path is sites/default/files) i have
I have too many identical files and i don't understand why...
This is a name of file in advagg_css :
css____tQ6DKNpjnnLOLLOo1chze6a0EuAzr40c2JW8LEnlk__CmbidT93019ZJXjBPnKuAOSV78GHKPC3vgAjyUWRvNg__U78DXVtmNgrsprQhJ0bcjElTm2p5INlkJg6oQm4a72o
How can I delete all these files without doing damage?
Maybe in performance/advagg/operations in box Cron Maintenance Tasks i must check
Clear All Stale Files
Remove all stale files. Scan all files in the advagg_css/js directories and remove the ones that have not been accessed in the last 30 days.
????
I hope you can help me...
Thanks a lot
I can guarantee that there are very few duplicate files in those directories. If you really want, you can manually delete every file in there; a lot of them will be generated again so you're back to having a lot of files (the css/js files get auto created on demand, just like image styles). AdvAgg is very good at preventing a 404 from happening when requesting an aggregated css/js file. You can adjust how old a file needs to be in order for it to be considered "stale". Inside of the core drupal_delete_file_if_stale() function is the drupal_stale_file_threshold variable. Changing this inside of your settings.php file to something like 2 days $conf['drupal_stale_file_threshold'] = 172800; will make Drupal more aggressive in terms of removing aggregated css and js files.
Long term if you want to reduce the number of different css/js files from being created you'll need to reduce the number of combinations/variations that are possible with your css and js assets. On the "admin/config/development/performance/advagg/bundler" page under raw grouping info it will tell you how many different groupings are currently possible, take that number and multiply it by the number of bundles (usually 2-6 if following a guide like this https://www.drupal.org/node/2493801 or 6-12 if using the default settings) and that's the number of files that can currently be generated. Multiply it by 2 for gzip. On one of our sites that gives us over 4k files.
In terms of file names the first base64 group is the file name, second base64 group are the file contents, and the third base64 group are the advagg settings. This allows for the aggregates contents to be recreated by just knowing the filename as all this additional info is stored in the database.

Options in bitbake to link files to the boot partition

I have a bitbake configuration that generates two partitions, the BOOT (FAT) partition containing uBoot, uEnv.txt, etc. and a root file system that gets mounted read-only. There may be instances where the filesystem isn't a separate partition, but rather a ramdisk, so I'm trying to enforce a design pattern that works in both instances:
What I'm trying to do is provide some of the files in the root filesystem as links to locations on the SD card. This way I can build a single SD card image and the minor edits for node IDs or names can be easily tweaked by end-users. So for example, if /etc/special_config.conf would be a useful one, then rather than store it on the read-only partition, a link would be created pointing back to the real file on the BOOT partition.
So far I've tried making a recipe that, for that case, does the following:
IMAGE_BOOT_FILES += "special_config.conf"
do_install () {
ln -s /media/BOOT/special_config.conf \
${D}${sysconfigdir}/special_config.conf
}
This doesn't seem to do anything. The IMAGE_BOOT_FILES doesn't collect the special_config.conf file into the BOOT partition, as if when the system image gets populated all of those changes get wiped out.
Has anyone seen a clever way to enforce this kind of behavior in BitBake?
If I understand correctly, you get your ${sysconfdir}/special_config.conf symlink in the image (via a package built from recipe mentioned), but you don't get the special_config.conf file on your BOOT partition using wic image fstype.
If that's the case, then the only problem is that you define IMAGE_BOOT_FILES in the package recipe, rather than defining it in the image recipe, because this variable is only evaluated at image build time. So drop that from your config file recipe and add it to the image recipe, it should work this way.

In cvs diff I want to see author name and date of files having difference

How can I get the author name and date of the different files, when I do a cvs diff.
M using wincvs on windows 2.1.1.1(build 1). I can also do it on unix server through command line.
thx
You can't, unless this information appears in the source (which it shouldn't, unless you want a conflict at every merge). You need to use other cvs commands for this; cvs log comes to mind, but it's been a while. You could always write a script or batch file which displays the changes' log entiries and diffs, though.

One to one correspending to files - in unix - log files

I am writing a Log Unifier program. That is, I have a system that produces logs:
my.log, my.log.1, my.log.2, my.log.3...
I want on each iteration to store the number of lines I've read from a certain file, so that on the next iteration - I can continue reading on from that place.
The problem is that when the files are full, they roll:
The last log is deleted
...
my.log.2 becomes my.log.3
my.log.1 becomes my.log.2
my.log becomes my.log.1
and a new my.log is created
I can ofcourse keep track of them, using inodes - which are almost a one-to-one correspondence to files.
I say "almost", because I fear of the following scenario:
Between two of my iterations - some files are deleted (let's say the logging is very fast), and are then new files are created and some have inodes of files just deleted. The problem is now - that I will mistake these files as old files - and start reading from line 500 (for example) instead of 0.
So I am hoping to find a way to solve this- here are a few directions I thought about - that may help you help me:
Either another 1-to-1 correspondence other than inodes.
An ability to mark a file. I thought about using chmod +x to mark the file as an
existing file, and for new files that don't have these permissions - I will know they are new - but if somebody were to change the permissions manually, that would confuse my program. So if you have any other way to mark.
I thought about creating soft links to a file that are deleted when the file is deleted. That would allow me to know which files got deleted.
Any way to get the "creation date"
Any idea that comes to mind - maybe using timestamps, atime, ctime, mtime in some clever way - all will be good, as long as they will allow me to know which files are new, or any idea creating a one-to-one correspondence to files.
Thank you
I can think of a few alternatives:
Use POSIX extended attributes to store metadata about each log file that your program can use for its operation.
It should be a safe assumption that the contents of old log files are not modified after being archived, i.e. after my.log becomes my.log.1. You could generate a hash for each file (e.g. SHA-256) to uniquely identify it.
All decent log formats embed a timestamp in each entry. You could use the timestamp of the first entry - or even the whole entry itself - in the file for identification purposes. Log files are usually rolled on a periodic basis, which would ensure a different starting timestamp for each file.

In reverse-history-search in zsh, is there a maximum # of items it will go back?

I use control-r interactive reverse history search in zsh all day long. Just now I tried to find something I haven't used in quite some time, and it wasn't there. But when I grepped my .zsh_history file, it was there.
Is there a maximum # of history entries reverse search will search? Can I configure this?
You can configure (in your .zshrc) how long the history per session and the stored one is:
HISTSIZE=5000 # session history size
SAVEHIST=1000 # saved history
HISTFILE=~/.zshistory # history file
That is what is searched by zsh, I am not aware of a limit that reverse-history-search uses.
You might want to check on the zsh-param(1) man page.
In-memory history may not contain entries that are in the history file (if the file size limit is larger than the in-memory limit) and the history file may not contain entries that are in memory (until they're written - either explicitly or when the shell exits - subject to size limits set by environment variables). There is no other limit on reverse-history-search.
This is true in Bash and I believe the Z shell is similar.

Resources