Home of the Squeezebox™ & Transporter® network music players.
Page 5 of 11 FirstFirst ... 34567 ... LastLast
Results 41 to 50 of 102
  1. #41
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,043
    Quote Originally Posted by chill View Post
    Can someone help with 'rsync'?

    Using the following rsync command, everything seems to copy over, and the 'last modified' timetag seems to come across correctly from the source file.
    Code:
    rsync -rtvhiO --delete /mnt/MusicBackup/MusicOgg/ /mnt/MusicInt/Music/
    Code:
    rsync -avhi --delete /mnt/MusicBackup/MusicOgg/ /mnt/MusicInt/Music/
    usually does the trick.
    Various SW: Web Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  2. #42
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by Roland0 View Post
    Code:
    outtime=$(stat -c"%Y" "$outfile") && intime=$(stat -c"%Y" "$infile")
    if [ -n "$outtime" ] && [ "$intime" -ne "$outtime" ]; then
    will reduce file accesses.
    Thank you - I had to look up the purpose of '&&'. So this will only bother to get intime if getting outtime succeeded. And after that it doesn't access the file again because it uses those two existing variables. Much more efficient - implemented.

  3. #43
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by Roland0 View Post
    Code:
    rsync -avhi --delete /mnt/MusicBackup/MusicOgg/ /mnt/MusicInt/Music/
    usually does the trick.
    I'm running a test of this now. The '-a' flag is apparently equivalent to '-rlptgoD', so my '-rtvhiO' differs only from your '-avhi' in that I'm excluding '-lpgoD', i.e.

    -l = copy symlinks: I don't have any
    -p = preserve permissions
    -g = preserve groups
    -o = preserve owner
    -D = preserve device files

    ...and I'm including
    -O = omit directories from -t check

    I was deliberately excluding the groups, owners and permissions checks because I had noticed a similar tendency to repeatedly update groups (as well as timestamps) when rsyncing my main library to my backup (with -avhi). I added '-O' because I'm not bothered when the directory was created - I'm only interested in the files. Symlinks and device files shouldn't matter in my case.

    So I don't believe that that's going to have any effect on the timestamp check that seems to be failing in my case. In fact. watching the output of the rsync process I see I'm now getting a lot of '>f..t..g...' updates (the 'g' is expected due to the '-g', but the 't' is still there). And I'm also getting a number of 'Operation not permitted' errors with 'chgrp' and 'mkstemp' - should I be running this with 'sudo'?

    I'll run the rsync command again once this one completes, but I'm not hopeful that the 't' updates will stop. What's causing this? It can't be anything to do with the RPi clock, because both disks are physically connected and mounted to the same RPi, and in any case it's a file attribute, not a clock check. Could it be that although the timestamps are the same to a certain precision, the different disk formats are storing them slightly differently? My source disk is 'PFS/NTFS' and my target disk is 'FAT32'. I wonder if I should use the '--modify-window=NUM' option to 'check modification times with reduced accuracy'.
    Last edited by chill; 2019-05-05 at 02:52.

  4. #44
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    The '--modify-window=1' option seems to have fixed it. I can now rerun the rsync command immediately after the first bulk sync, and nothing changes.

    Code:
    rsync -rtvhiO --delete --modify-window=1 /mnt/MusicBackup/MusicOgg/ /mnt/MusicInt/Music/
    That option allows the times to differ by up to 1 second before they are considered to be different. Apparently FAT uses a resolution of 2 seconds for timestamps, so they're only accurate to the nearest second.

  5. #45
    Senior Member
    Join Date
    May 2010
    Location
    London, UK
    Posts
    544
    Quote Originally Posted by chill View Post
    The '--modify-window=1' option seems to have fixed it. I can now rerun the rsync command immediately after the first bulk sync, and nothing changes.

    Code:
    rsync -rtvhiO --delete --modify-window=1 /mnt/MusicBackup/MusicOgg/ /mnt/MusicInt/Music/
    That option allows the times to differ by up to 1 second before they are considered to be different. Apparently FAT uses a resolution of 2 seconds for timestamps, so they're only accurate to the nearest second.
    You may yet be surprised at the next semi-annual clock change. FAT defines the file timestamp to be "local time", in whatever time zone/winter/summer time arrangement you happen to be in. And, by default, Linux honours this. But your source file system's timestamps may well be strictly UTC.

    I use the tz=UTC mount option with my FAT drive, which causes Linux to interpret all timestamps as UTC, despite official FAT semantics.

    Another approach is to allow times to differ by an hour before the files are considered to be different.

  6. #46
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by Roland0 View Post
    Code:
    outtime=$(stat -c"%Y" "$outfile") && intime=$(stat -c"%Y" "$infile")
    if [ -n "$outtime" ] && [ "$intime" -ne "$outtime" ]; then
    will reduce file accesses.

    I had to change the logic slightly, because I want the transcoding/editing/copying to take place if either the source and target files have different timestamps, or the target file doesn't exist. So my test is as follows:

    Code:
    	outtime=$(stat -c"%Y" "$outfile") && intime=$(stat -c"%Y" "$infile")
    	if [ -z "$outtime" ] || [ "$intime" -ne "$outtime" ]; then
    So I think I'm done now. I will set up my spare Pi Zero W as follows:
    - use cron to backup my main library, which is mounted as a network share from my main Pi 3B+. It'll use rsync to another hard disk attached to the Zero, and will exclude group, owner and permission checks, as well as allowing for timestamps to be up to 1 second different.
    - run my script to update my compressed library, which is in a separate folder on the backup disk, from this backup.

    This will ensure that my backup and my compressed copy are always up to date. I can then occasionally rsync the compressed copy to the MicroSD card in the 3A+ in my camper van.

    I'm a happy camper now . Thanks for the advice and tips in this thread - most appreciated.

  7. #47
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by mrw View Post
    You may yet be surprised at the next semi-annual clock change. FAT defines the file timestamp to be "local time", in whatever time zone/winter/summer time arrangement you happen to be in. And, by default, Linux honours this. But your source file system's timestamps may well be strictly UTC.

    I use the tz=UTC mount option with my FAT drive, which causes Linux to interpret all timestamps as UTC, despite official FAT semantics.

    Another approach is to allow times to differ by an hour before the files are considered to be different.
    Thank you - I didn't spot this until after I'd posted. Something else to look out for!

  8. #48
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Just for completeness - here's a photo of my camper van Squeezebox setup. I was worried that the single USB port on the 3A+ might be a bit restrictive, but in fact with my compressed library now on a separate partition on the MicroSD card the USB socket isn't even used.

    The Pi makes its own wifi, and runs players on the built-in 3.5mm socket (for the AUX IN on the dashboard radio), over Airplay (to a battery-powered Audio Pro C3) and over Bluetooth. And I carry a Boom as well, which runs very nicely off the 12VDC supply in the camper. More players than I need, but what an astonishing ecosystem the Squeezebox has evolved into!*



    I guess I need to study the recent threads on shutting down LMS smoothly now. It was a bit of a surprise to read that the resilience of pCP to having its power cut doesn't necessarily apply when running LMS as well.

    *EDIT: And I forgot to mention that it's all controlled with iPeng from my phone, which also functions as another player!
    Last edited by chill; 2019-05-05 at 13:23.

  9. #49
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Looking for some more advice please.

    How can I capture the terminal output of oggenc to a file? I don't mean the encoded audio, which goes to the file specified with '-o'. I'd like to record what appears in the terminal to a log file, since I plan to run my script as a cron job. Whatever I do though, it only ever seems to appear in the terminal window. I've tried '>' and '| tee'.

    The terminal output includes a spinning cursor progress indicator ( \|/-\|/- ), so the captured output might look a bit messy if I get it to work - could that be why I can't capture it?

    Any tips?

  10. #50
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    2,716
    If you run it in "quiet" mode does all output disappear?
    If not then might be enough left to use.

    Quick scan of source code shows that if in Quiet mode then progress indicator is turned off.

    Some of the output is sent to stderr even though it is not an error - e.g.
    Code:
    else if(!opt.quiet) {
                    fprintf(stderr, _("Resampling input from %d Hz to %d Hz\n"), fromrate, opt.resamplefreq);
    so you could try redirecting stderr (2>) and see what goes in there.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •