rsync the info to a file

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite
1












I use rsync to backup my data from one server to the other. This works great.



rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION


The output display what has been copied over:



building file list ...
11 files to consider
./
server/

server/myfile.txt
3152 100% 0.00kB/s 0:00:00 (xfer#1, to-check=8/11)
server/test/
server/test/logfile01
8266 100% 7.88MB/s 0:00:00 (xfer#2, to-check=6/11)
server/test/logfile07
41004 100% 39.10MB/s 0:00:00 (xfer#3, to-check=5/11)
server/test/logfile08
318 100% 310.55kB/s 0:00:00 (xfer#4, to-check=4/11)
server/test/logfile09
8262 100% 7.88MB/s 0:00:00 (xfer#5, to-check=3/11)
server/test/logfile30
40325 100% 12.82MB/s 0:00:00 (xfer#6, to-check=2/11)
server/test/logfile31
792 100% 193.36kB/s 0:00:00 (xfer#7, to-check=1/11)
server/test/logfile32
3152 100% 769.53kB/s 0:00:00 (xfer#8, to-check=0/11)

sent 105902 bytes received 214 bytes 14148.80 bytes/sec
total size is 105271 speedup is 0.99


I would like to get this output and save it to a file for reference. So I tried this,



test_output=$(rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION)

getscript()
pgrep -lf ".[ /]$1(

getscript "sync.sh" >/dev/null && echo "sync.sh" $test_output >> outputfile.txt;


It works great but the output are all on one line. It's not nicely indented like above. How can I output it so it will be nicely indented?



tks







share|improve this question















  • 1




    What's the reason for your getscript function?
    – Kusalananda
    Aug 3 at 17:30
















up vote
0
down vote

favorite
1












I use rsync to backup my data from one server to the other. This works great.



rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION


The output display what has been copied over:



building file list ...
11 files to consider
./
server/

server/myfile.txt
3152 100% 0.00kB/s 0:00:00 (xfer#1, to-check=8/11)
server/test/
server/test/logfile01
8266 100% 7.88MB/s 0:00:00 (xfer#2, to-check=6/11)
server/test/logfile07
41004 100% 39.10MB/s 0:00:00 (xfer#3, to-check=5/11)
server/test/logfile08
318 100% 310.55kB/s 0:00:00 (xfer#4, to-check=4/11)
server/test/logfile09
8262 100% 7.88MB/s 0:00:00 (xfer#5, to-check=3/11)
server/test/logfile30
40325 100% 12.82MB/s 0:00:00 (xfer#6, to-check=2/11)
server/test/logfile31
792 100% 193.36kB/s 0:00:00 (xfer#7, to-check=1/11)
server/test/logfile32
3152 100% 769.53kB/s 0:00:00 (xfer#8, to-check=0/11)

sent 105902 bytes received 214 bytes 14148.80 bytes/sec
total size is 105271 speedup is 0.99


I would like to get this output and save it to a file for reference. So I tried this,



test_output=$(rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION)

getscript()
pgrep -lf ".[ /]$1(

getscript "sync.sh" >/dev/null && echo "sync.sh" $test_output >> outputfile.txt;


It works great but the output are all on one line. It's not nicely indented like above. How can I output it so it will be nicely indented?



tks







share|improve this question















  • 1




    What's the reason for your getscript function?
    – Kusalananda
    Aug 3 at 17:30












up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I use rsync to backup my data from one server to the other. This works great.



rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION


The output display what has been copied over:



building file list ...
11 files to consider
./
server/

server/myfile.txt
3152 100% 0.00kB/s 0:00:00 (xfer#1, to-check=8/11)
server/test/
server/test/logfile01
8266 100% 7.88MB/s 0:00:00 (xfer#2, to-check=6/11)
server/test/logfile07
41004 100% 39.10MB/s 0:00:00 (xfer#3, to-check=5/11)
server/test/logfile08
318 100% 310.55kB/s 0:00:00 (xfer#4, to-check=4/11)
server/test/logfile09
8262 100% 7.88MB/s 0:00:00 (xfer#5, to-check=3/11)
server/test/logfile30
40325 100% 12.82MB/s 0:00:00 (xfer#6, to-check=2/11)
server/test/logfile31
792 100% 193.36kB/s 0:00:00 (xfer#7, to-check=1/11)
server/test/logfile32
3152 100% 769.53kB/s 0:00:00 (xfer#8, to-check=0/11)

sent 105902 bytes received 214 bytes 14148.80 bytes/sec
total size is 105271 speedup is 0.99


I would like to get this output and save it to a file for reference. So I tried this,



test_output=$(rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION)

getscript()
pgrep -lf ".[ /]$1(

getscript "sync.sh" >/dev/null && echo "sync.sh" $test_output >> outputfile.txt;


It works great but the output are all on one line. It's not nicely indented like above. How can I output it so it will be nicely indented?



tks







share|improve this question











I use rsync to backup my data from one server to the other. This works great.



rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION


The output display what has been copied over:



building file list ...
11 files to consider
./
server/

server/myfile.txt
3152 100% 0.00kB/s 0:00:00 (xfer#1, to-check=8/11)
server/test/
server/test/logfile01
8266 100% 7.88MB/s 0:00:00 (xfer#2, to-check=6/11)
server/test/logfile07
41004 100% 39.10MB/s 0:00:00 (xfer#3, to-check=5/11)
server/test/logfile08
318 100% 310.55kB/s 0:00:00 (xfer#4, to-check=4/11)
server/test/logfile09
8262 100% 7.88MB/s 0:00:00 (xfer#5, to-check=3/11)
server/test/logfile30
40325 100% 12.82MB/s 0:00:00 (xfer#6, to-check=2/11)
server/test/logfile31
792 100% 193.36kB/s 0:00:00 (xfer#7, to-check=1/11)
server/test/logfile32
3152 100% 769.53kB/s 0:00:00 (xfer#8, to-check=0/11)

sent 105902 bytes received 214 bytes 14148.80 bytes/sec
total size is 105271 speedup is 0.99


I would like to get this output and save it to a file for reference. So I tried this,



test_output=$(rsync -aktvu -e 'ssh -p 22' --modify-window=1 --progress $SOURCE $USER@$SERVER:$DESTINATION)

getscript()
pgrep -lf ".[ /]$1(

getscript "sync.sh" >/dev/null && echo "sync.sh" $test_output >> outputfile.txt;


It works great but the output are all on one line. It's not nicely indented like above. How can I output it so it will be nicely indented?



tks









share|improve this question










share|improve this question




share|improve this question









asked Aug 3 at 17:13









Tran

1




1







  • 1




    What's the reason for your getscript function?
    – Kusalananda
    Aug 3 at 17:30












  • 1




    What's the reason for your getscript function?
    – Kusalananda
    Aug 3 at 17:30







1




1




What's the reason for your getscript function?
– Kusalananda
Aug 3 at 17:30




What's the reason for your getscript function?
– Kusalananda
Aug 3 at 17:30










1 Answer
1






active

oldest

votes

















up vote
2
down vote













man rsync will show an option to log output to a logfile:




--log-file=FILE
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 requested for the client side and/or the server side of a
non-daemon transfer. If specified as a client option, transfer logging will be enabled with a
default format of "%i %n%L". See the --log-file-format option if you wish to override this.







share|improve this answer





















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460386%2frsync-the-info-to-a-file%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    man rsync will show an option to log output to a logfile:




    --log-file=FILE
    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 requested for the client side and/or the server side of a
    non-daemon transfer. If specified as a client option, transfer logging will be enabled with a
    default format of "%i %n%L". See the --log-file-format option if you wish to override this.







    share|improve this answer

























      up vote
      2
      down vote













      man rsync will show an option to log output to a logfile:




      --log-file=FILE
      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 requested for the client side and/or the server side of a
      non-daemon transfer. If specified as a client option, transfer logging will be enabled with a
      default format of "%i %n%L". See the --log-file-format option if you wish to override this.







      share|improve this answer























        up vote
        2
        down vote










        up vote
        2
        down vote









        man rsync will show an option to log output to a logfile:




        --log-file=FILE
        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 requested for the client side and/or the server side of a
        non-daemon transfer. If specified as a client option, transfer logging will be enabled with a
        default format of "%i %n%L". See the --log-file-format option if you wish to override this.







        share|improve this answer













        man rsync will show an option to log output to a logfile:




        --log-file=FILE
        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 requested for the client side and/or the server side of a
        non-daemon transfer. If specified as a client option, transfer logging will be enabled with a
        default format of "%i %n%L". See the --log-file-format option if you wish to override this.








        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Aug 3 at 19:18









        roaima

        39.2k544105




        39.2k544105






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460386%2frsync-the-info-to-a-file%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?