Crontab doesn't work

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











up vote
-1
down vote

favorite












I get an issue using Crontab. My script is working standalone but it is not working using Crontab.



Environment : Ubuntu



Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js



Edit #1 :



which node : /usr/local/bin/node










share|improve this question























  • What is the output of which node?
    – Hunter.S.Thompson
    Oct 3 '17 at 13:43






  • 3




    Add MAILTO in your cron and you should receive an email with any errors.
    – Raman Sailopal
    Oct 3 '17 at 13:44






  • 1




    @Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
    – Archemar
    Oct 3 '17 at 13:49










  • See edit #1 for the command which node. Ok so I need to execute node /var/www/GestiawebParser/index.js using a shell script ?
    – tonymx227
    Oct 3 '17 at 13:52











  • Is it really on 2 separate lines?
    – Jaroslav Kucera
    Oct 3 '17 at 13:58














up vote
-1
down vote

favorite












I get an issue using Crontab. My script is working standalone but it is not working using Crontab.



Environment : Ubuntu



Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js



Edit #1 :



which node : /usr/local/bin/node










share|improve this question























  • What is the output of which node?
    – Hunter.S.Thompson
    Oct 3 '17 at 13:43






  • 3




    Add MAILTO in your cron and you should receive an email with any errors.
    – Raman Sailopal
    Oct 3 '17 at 13:44






  • 1




    @Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
    – Archemar
    Oct 3 '17 at 13:49










  • See edit #1 for the command which node. Ok so I need to execute node /var/www/GestiawebParser/index.js using a shell script ?
    – tonymx227
    Oct 3 '17 at 13:52











  • Is it really on 2 separate lines?
    – Jaroslav Kucera
    Oct 3 '17 at 13:58












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I get an issue using Crontab. My script is working standalone but it is not working using Crontab.



Environment : Ubuntu



Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js



Edit #1 :



which node : /usr/local/bin/node










share|improve this question















I get an issue using Crontab. My script is working standalone but it is not working using Crontab.



Environment : Ubuntu



Crontab (sudo crontab -e) : 0 0 * * * /usr/local/bin/node /var/www/GestiawebParser/index.js



Edit #1 :



which node : /usr/local/bin/node







ubuntu cron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 3 '17 at 13:51

























asked Oct 3 '17 at 13:39









tonymx227

1246




1246











  • What is the output of which node?
    – Hunter.S.Thompson
    Oct 3 '17 at 13:43






  • 3




    Add MAILTO in your cron and you should receive an email with any errors.
    – Raman Sailopal
    Oct 3 '17 at 13:44






  • 1




    @Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
    – Archemar
    Oct 3 '17 at 13:49










  • See edit #1 for the command which node. Ok so I need to execute node /var/www/GestiawebParser/index.js using a shell script ?
    – tonymx227
    Oct 3 '17 at 13:52











  • Is it really on 2 separate lines?
    – Jaroslav Kucera
    Oct 3 '17 at 13:58
















  • What is the output of which node?
    – Hunter.S.Thompson
    Oct 3 '17 at 13:43






  • 3




    Add MAILTO in your cron and you should receive an email with any errors.
    – Raman Sailopal
    Oct 3 '17 at 13:44






  • 1




    @Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
    – Archemar
    Oct 3 '17 at 13:49










  • See edit #1 for the command which node. Ok so I need to execute node /var/www/GestiawebParser/index.js using a shell script ?
    – tonymx227
    Oct 3 '17 at 13:52











  • Is it really on 2 separate lines?
    – Jaroslav Kucera
    Oct 3 '17 at 13:58















What is the output of which node?
– Hunter.S.Thompson
Oct 3 '17 at 13:43




What is the output of which node?
– Hunter.S.Thompson
Oct 3 '17 at 13:43




3




3




Add MAILTO in your cron and you should receive an email with any errors.
– Raman Sailopal
Oct 3 '17 at 13:44




Add MAILTO in your cron and you should receive an email with any errors.
– Raman Sailopal
Oct 3 '17 at 13:44




1




1




@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
– Archemar
Oct 3 '17 at 13:49




@Hunter.S.Thompson program node is find since given in absolute path, however it might be a shell script (or a binary) that relay on command not in cron's $PATH value.
– Archemar
Oct 3 '17 at 13:49












See edit #1 for the command which node. Ok so I need to execute node /var/www/GestiawebParser/index.js using a shell script ?
– tonymx227
Oct 3 '17 at 13:52





See edit #1 for the command which node. Ok so I need to execute node /var/www/GestiawebParser/index.js using a shell script ?
– tonymx227
Oct 3 '17 at 13:52













Is it really on 2 separate lines?
– Jaroslav Kucera
Oct 3 '17 at 13:58




Is it really on 2 separate lines?
– Jaroslav Kucera
Oct 3 '17 at 13:58










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










Crontab issues can be solved by:



  • test the script outside of crontab (you did this)

  • add a test script to ensure it's enabled (like * * * * * /bin/echo test > /test.txt)

  • use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)

  • prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with >> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt)





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%2f395844%2fcrontab-doesnt-work%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
    4
    down vote



    accepted










    Crontab issues can be solved by:



    • test the script outside of crontab (you did this)

    • add a test script to ensure it's enabled (like * * * * * /bin/echo test > /test.txt)

    • use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)

    • prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with >> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt)





    share|improve this answer
























      up vote
      4
      down vote



      accepted










      Crontab issues can be solved by:



      • test the script outside of crontab (you did this)

      • add a test script to ensure it's enabled (like * * * * * /bin/echo test > /test.txt)

      • use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)

      • prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with >> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt)





      share|improve this answer






















        up vote
        4
        down vote



        accepted







        up vote
        4
        down vote



        accepted






        Crontab issues can be solved by:



        • test the script outside of crontab (you did this)

        • add a test script to ensure it's enabled (like * * * * * /bin/echo test > /test.txt)

        • use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)

        • prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with >> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt)





        share|improve this answer












        Crontab issues can be solved by:



        • test the script outside of crontab (you did this)

        • add a test script to ensure it's enabled (like * * * * * /bin/echo test > /test.txt)

        • use env to test and correct environment settings (a common alternative to exporting the PATH variable is to use absolute paths but obviously that only works for executables and PATH) (which, file)

        • prefix your crontab with MAILTO or otherwise collect logging information (like suffixing with >> /out.txt 2>> /err.txt; /bin/echo $? >> /return.txt)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 3 '17 at 14:18









        user1133275

        2,267412




        2,267412



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395844%2fcrontab-doesnt-work%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?