Help with output redirect please.

  • I have loaded my Rock64 with LibreElec, and I am also using it as my Samba server.

    I want to run a sync between the two USB hard drives I have attached to maintain a backup of my media.

    I can't seem to get the command quite right. I want to copy the data, and redirect the output to a text file so I can see what it is doing later on.

    I do want it to overwrite the old log file.


    This is the command I am trying to use:

    Code
    1. rsync -rav --modify-window=300 --homan-readable --progress --stats --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ |& tee /var/media/8TB_WD2/synclog.txt
    2. -sh: syntax error: unexpected "&"

    I have also tried > but I get no log file output at all.


    Code
    1. rsync -rav --modify-window=300 --homan-readable --progress --stats --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ > /var/media/8TB_WD2/synclog.txt


    If I cut off the redirect, it outputs to bash exactly what I would expect, but I can't get it to output to a log file.


    Works with output to bash ->

    Code
    1. rsync -rav --modify-window=300 --homan-readable --progress --stats --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/


    Can someone make a suggestion. I am probably missing something crazy simple, but just can't see it.


    PS for some reason the word hu.man is censored here. Please replace the homan with hu.man when reading my code above.

    -Written by a team of angry monkeys.

  • Maybe try


    rsync -rav --modify-window=300 --homan-readable --progress --log-file=var/media/8TB_WD2/synclog.txt --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ &>/dev/null

  • It would be nice to get the output in the terminal and the log file, but I can live with not having it in the terminal.


    Thanks for the suggestion, but no luck. The rsync starts, but there is no log file.



    I am using almost identical code on my dd-wrt router, and it works there as expected.

    Code
    1. DD-WRT:
    2. rsync -rav --modify-window=300 --hu.man-readable --progress --stats --force --delete /tmp/mnt/8TB_USB/ /tmp/mnt/5TB_Seagate_USB/ > /tmp/mnt/8TB_USB/rsync_Status.txt

    -Written by a team of angry monkeys.

    Edited once, last by wizardknight ().

  • from the man page

    Code
    1. --log-file=FILE
    2. This option causes rsync to log what it is doing to a file. This is similar to the logging that a daemon does, but can be
    3. requested for the client side and/or the server side of a non-daemon transfer. If specified as a client option, transfer log‐
    4. ging will be enabled with a default format of "%i %n%L". See the --log-file-format option if you wish to override this..
  • For general use

    Code
    1. some_command 2>&1 | tee log_file

    Done giving support here because of last events.

  • Just tried both suggestions, and there was no log file created.


    Suggestion #1

    Code
    1. rsync -rav --modify-window=300 --hu.man-readable --progress --log-file=/var/media/8TB_WD2/synclog.txt --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ &>/dev/null


    Suggestion #2

    Code
    1. rsync -rav --modify-window=300 --hu.man-readable --progress --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ 2>&1 | tee /var/media/8TB_WD2/synclog.txt



    Terminal output:

    Code
    1. ^CLibreELEC:/var/media/8TB_WD2/Media/Movies # rsync -rav --modify-window=300 --hu.man-readable --progress --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ 2>&1 | tee /var/media/8TB_WD2/synclog.txt
    2. sending incremental file list
    3. deleting synclog.txt
    4. ./
    5. Media/Epsoides/Hogans Heroes/Hogans.Heroes.S1.DVDRip/
    6. Media/Epsoides/Hogans Heroes/Hogans.Heroes.S1.DVDRip/Hogans.Heroes.1x32.dvdrip.xvid-BBBear_TMindTV.avi
    7. 314.32M 100% 50.49MB/s 0:00:05 (xfr#1, ir-chk=1013/63529)


    Second SSH to check for log file:


    Am I missing something, or is the system not working right?

    I feel like an idiot. I can't see any reason why all of these would fail to generate some kind of output file.


    I did just notice a .fuse_hidden0000f49000000005 file being created when I kick off these commands.

    I am assuming that is a temp file for rsync, but it is the only thing at the root of that drive which is new.

    It also vanishes when I kill the rsync command.


    Thanks for the suggestions. :)

    Maybe I need to get out my voodoo chicken bones and grass skirt...

    Could be running low on magic smoke.

    -Written by a team of angry monkeys.

    Edited 2 times, last by wizardknight ().

  • I didn’t test to output the log to the destination disk maybe is getting deleted at the end. Try another location maybe /storage for the log file

  • I didn’t test to output the log to the destination disk maybe is getting deleted at the end. Try another location maybe /storage for the log file

    I redirected the log to storage, and it worked. A gold star to you.

    Code
    1. rsync -rav --modify-window=300 --hu.man-readable --progress --log-file=/storage/backup/synclog.txt --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ &>/dev/null


    Code
    1. LibreELEC:~/backup # ls
    2. synclog.txt


    Now the question is why can't I write to my external HD as root? That is just all kinds of special.




    nickr

    Can you tell me why hum.an is a censored word? I have to admit I am curious.

    Is this place ran by aliens, or powered by the screams of children? That would make sense.

    -Written by a team of angry monkeys.

  • No I don't know, I was going to correct you on your options, but it wouldn't let me, and I realised that your post was deliberately misspelled.


    I'll see if someone higher up the foad chain can help with that.


    PS apparently f o o d is banned too.

  • No I don't know, I was going to correct you on your options, but it wouldn't let me, and I realised that your post was deliberately misspelled.


    I'll see if someone higher up the foad chain can help with that.


    PS apparently f o o d is banned too.

    It must be aliens. They don't want the secret getting out. Homans are f00d!

    hqdefault.jpg

    -Written by a team of angry monkeys.

  • Resolved.

    I am not sure how, but I can redirect to my external hd now.

    The command is the same as the one I first tried.


    Code
    1. rsync -rav --modify-window=300 --homan-readable --progress --stats --force --delete /var/media/8TB_WD/ /var/media/8TB_WD2/ > /var/media/8TB_WD2/synclog.txt

    I guess I was not biting my tongue just right.


    Now to stick it in cron and see if it plays nice there...

    -Written by a team of angry monkeys.