Monitor shell script to go with crontab -e

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











up vote
0
down vote

favorite












Ive been messing around with raspberry pis now for about a month and have come abit stuck.



I have set up a media server with 1 pi (6TB) and set up osmc with another (1TB). In the media server i have sonarr and radarr set up that will organise files into films and tv shows. I have mounted the server in osmc. What I need is a script to copy only new files from one directory to another. The files will be in subfolders. I was thinking crontab with a script linked to it to search every 15 mins to update osmc folders. 1 for tv shows 1 for movies.



Any help would be much appreciated
Thank you







share|improve this question
















  • 2




    So you need help with the crontab? the script? both? The crontab part is easy, but what the script has to do is far from clear (at least to me).
    – NickD
    Jan 5 at 2:47






  • 1




    Have you looked into rsync and read the man page? I don't think you need a script at all. I think you need a fancy rsync command with a bunch of flags.
    – Wildcard
    Jan 5 at 3:04










  • As mentionned by Wildcard, I think you need a rsync command line in a crontab to feet your needs. maybe something similar to rsync -zauv /path/sources/tree /path/destination/ then all subfolders updates modified & new files will be add/updated on destination path
    – francois P
    Jan 5 at 7:32














up vote
0
down vote

favorite












Ive been messing around with raspberry pis now for about a month and have come abit stuck.



I have set up a media server with 1 pi (6TB) and set up osmc with another (1TB). In the media server i have sonarr and radarr set up that will organise files into films and tv shows. I have mounted the server in osmc. What I need is a script to copy only new files from one directory to another. The files will be in subfolders. I was thinking crontab with a script linked to it to search every 15 mins to update osmc folders. 1 for tv shows 1 for movies.



Any help would be much appreciated
Thank you







share|improve this question
















  • 2




    So you need help with the crontab? the script? both? The crontab part is easy, but what the script has to do is far from clear (at least to me).
    – NickD
    Jan 5 at 2:47






  • 1




    Have you looked into rsync and read the man page? I don't think you need a script at all. I think you need a fancy rsync command with a bunch of flags.
    – Wildcard
    Jan 5 at 3:04










  • As mentionned by Wildcard, I think you need a rsync command line in a crontab to feet your needs. maybe something similar to rsync -zauv /path/sources/tree /path/destination/ then all subfolders updates modified & new files will be add/updated on destination path
    – francois P
    Jan 5 at 7:32












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Ive been messing around with raspberry pis now for about a month and have come abit stuck.



I have set up a media server with 1 pi (6TB) and set up osmc with another (1TB). In the media server i have sonarr and radarr set up that will organise files into films and tv shows. I have mounted the server in osmc. What I need is a script to copy only new files from one directory to another. The files will be in subfolders. I was thinking crontab with a script linked to it to search every 15 mins to update osmc folders. 1 for tv shows 1 for movies.



Any help would be much appreciated
Thank you







share|improve this question












Ive been messing around with raspberry pis now for about a month and have come abit stuck.



I have set up a media server with 1 pi (6TB) and set up osmc with another (1TB). In the media server i have sonarr and radarr set up that will organise files into films and tv shows. I have mounted the server in osmc. What I need is a script to copy only new files from one directory to another. The files will be in subfolders. I was thinking crontab with a script linked to it to search every 15 mins to update osmc folders. 1 for tv shows 1 for movies.



Any help would be much appreciated
Thank you









share|improve this question











share|improve this question




share|improve this question










asked Jan 5 at 2:21









Azer.B

11




11







  • 2




    So you need help with the crontab? the script? both? The crontab part is easy, but what the script has to do is far from clear (at least to me).
    – NickD
    Jan 5 at 2:47






  • 1




    Have you looked into rsync and read the man page? I don't think you need a script at all. I think you need a fancy rsync command with a bunch of flags.
    – Wildcard
    Jan 5 at 3:04










  • As mentionned by Wildcard, I think you need a rsync command line in a crontab to feet your needs. maybe something similar to rsync -zauv /path/sources/tree /path/destination/ then all subfolders updates modified & new files will be add/updated on destination path
    – francois P
    Jan 5 at 7:32












  • 2




    So you need help with the crontab? the script? both? The crontab part is easy, but what the script has to do is far from clear (at least to me).
    – NickD
    Jan 5 at 2:47






  • 1




    Have you looked into rsync and read the man page? I don't think you need a script at all. I think you need a fancy rsync command with a bunch of flags.
    – Wildcard
    Jan 5 at 3:04










  • As mentionned by Wildcard, I think you need a rsync command line in a crontab to feet your needs. maybe something similar to rsync -zauv /path/sources/tree /path/destination/ then all subfolders updates modified & new files will be add/updated on destination path
    – francois P
    Jan 5 at 7:32







2




2




So you need help with the crontab? the script? both? The crontab part is easy, but what the script has to do is far from clear (at least to me).
– NickD
Jan 5 at 2:47




So you need help with the crontab? the script? both? The crontab part is easy, but what the script has to do is far from clear (at least to me).
– NickD
Jan 5 at 2:47




1




1




Have you looked into rsync and read the man page? I don't think you need a script at all. I think you need a fancy rsync command with a bunch of flags.
– Wildcard
Jan 5 at 3:04




Have you looked into rsync and read the man page? I don't think you need a script at all. I think you need a fancy rsync command with a bunch of flags.
– Wildcard
Jan 5 at 3:04












As mentionned by Wildcard, I think you need a rsync command line in a crontab to feet your needs. maybe something similar to rsync -zauv /path/sources/tree /path/destination/ then all subfolders updates modified & new files will be add/updated on destination path
– francois P
Jan 5 at 7:32




As mentionned by Wildcard, I think you need a rsync command line in a crontab to feet your needs. maybe something similar to rsync -zauv /path/sources/tree /path/destination/ then all subfolders updates modified & new files will be add/updated on destination path
– francois P
Jan 5 at 7:32










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Thanks for the help and pointing me to rsync. I made this script



#!/bin/sh

cd /directory/of/source/

find -type f -mmin -(time in mins) -exec rsync -zauv /directory/of/destination/ ;


Ran it on 2 test folders and all seemed to work. Just to link it to crontab and all done.






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%2f414901%2fmonitor-shell-script-to-go-with-crontab-e%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
    0
    down vote













    Thanks for the help and pointing me to rsync. I made this script



    #!/bin/sh

    cd /directory/of/source/

    find -type f -mmin -(time in mins) -exec rsync -zauv /directory/of/destination/ ;


    Ran it on 2 test folders and all seemed to work. Just to link it to crontab and all done.






    share|improve this answer


























      up vote
      0
      down vote













      Thanks for the help and pointing me to rsync. I made this script



      #!/bin/sh

      cd /directory/of/source/

      find -type f -mmin -(time in mins) -exec rsync -zauv /directory/of/destination/ ;


      Ran it on 2 test folders and all seemed to work. Just to link it to crontab and all done.






      share|improve this answer
























        up vote
        0
        down vote










        up vote
        0
        down vote









        Thanks for the help and pointing me to rsync. I made this script



        #!/bin/sh

        cd /directory/of/source/

        find -type f -mmin -(time in mins) -exec rsync -zauv /directory/of/destination/ ;


        Ran it on 2 test folders and all seemed to work. Just to link it to crontab and all done.






        share|improve this answer














        Thanks for the help and pointing me to rsync. I made this script



        #!/bin/sh

        cd /directory/of/source/

        find -type f -mmin -(time in mins) -exec rsync -zauv /directory/of/destination/ ;


        Ran it on 2 test folders and all seemed to work. Just to link it to crontab and all done.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 7 at 14:46









        Jeff Schaller

        31.8k848109




        31.8k848109










        answered Jan 5 at 15:08









        Azer.B

        11




        11






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414901%2fmonitor-shell-script-to-go-with-crontab-e%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?