How to fix “Bad minute” error while installing a new crontab





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







5















I've installed a fresh Ubuntu 16.04 to replace my Windows OS.



I'm trying to setup cronjobs to run mangento 2.1 via Ampps softaculous. The software has been successfully installed (both ampps and magento) and it's running well.
I'm trying to setup a crontab but it seems there is an error on the first line second 25.



This is what I'm trying to add in to the crontab for the Ampps user, using the command sudo crontab -e -u ampps



* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/update/cron.php >> /usr/local/ampps/www/localshop.dev.dev/var/log/update.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev.dev/bin/magento setup:cron:run >> /usr/local/ampps/www/localshop.dev.dev/var/log/setup.cron.log


What am I doing wrong?



I followed an error message in magento 2.1 admin that referred to this troubleshoot link for the version 2.0
and to this configuration guide










share|improve this question




















  • 2





    First glance: you may have lines which have no * * * * * so cron can't interpret the items. Crontabs are line-break delimited to state "This task runs with the given configuration, and that task runs with a different one, etc.". Is this just a formatting screwup with your copy/paste or do the linebreaks actually exist between /usr/local/ampps/php-5.6/etc and the rest of the lines as the code-formatting shows?

    – Thomas Ward
    Jul 10 '16 at 15:50













  • Hey Thomas thanks about that, when you mentioned line break i did check the formating and it helped fix the crontab that has been now installed. I did also changed the format in 30 20 * * * and seems working now.

    – user564658
    Jul 10 '16 at 19:22













  • Hi, I understand the problem neither from yr post not from the given comments and answer. Have you modified yr post after receiving comments and perhaps after accepting the answer ? Comments and accepted answer both refer to errors in yr proposed crontab entries, that are either not there or not recognizable anymore. It's ok to correct a typo or a bad phrasing, but not an error if, in doing so, you take away the meaning of yr post. In that case yr readers cannot understand anymore what the prbm was. Am I wrong here ?

    – Cbhihe
    Jul 12 '16 at 6:32






  • 1





    @Cbhihe thanks for your comment. Your are absolutely right, I did edit the post once received Thomas W. comment and terdon answer and the question doesn't make sense anymore now. Sorry about that. I'm going to copy back linebreakes into the question so it will make sense.

    – user564658
    Jul 12 '16 at 14:12











  • This error happends when the volume of crontab file is full.

    – bokan
    Dec 6 '18 at 14:56




















5















I've installed a fresh Ubuntu 16.04 to replace my Windows OS.



I'm trying to setup cronjobs to run mangento 2.1 via Ampps softaculous. The software has been successfully installed (both ampps and magento) and it's running well.
I'm trying to setup a crontab but it seems there is an error on the first line second 25.



This is what I'm trying to add in to the crontab for the Ampps user, using the command sudo crontab -e -u ampps



* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/update/cron.php >> /usr/local/ampps/www/localshop.dev.dev/var/log/update.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev.dev/bin/magento setup:cron:run >> /usr/local/ampps/www/localshop.dev.dev/var/log/setup.cron.log


What am I doing wrong?



I followed an error message in magento 2.1 admin that referred to this troubleshoot link for the version 2.0
and to this configuration guide










share|improve this question




















  • 2





    First glance: you may have lines which have no * * * * * so cron can't interpret the items. Crontabs are line-break delimited to state "This task runs with the given configuration, and that task runs with a different one, etc.". Is this just a formatting screwup with your copy/paste or do the linebreaks actually exist between /usr/local/ampps/php-5.6/etc and the rest of the lines as the code-formatting shows?

    – Thomas Ward
    Jul 10 '16 at 15:50













  • Hey Thomas thanks about that, when you mentioned line break i did check the formating and it helped fix the crontab that has been now installed. I did also changed the format in 30 20 * * * and seems working now.

    – user564658
    Jul 10 '16 at 19:22













  • Hi, I understand the problem neither from yr post not from the given comments and answer. Have you modified yr post after receiving comments and perhaps after accepting the answer ? Comments and accepted answer both refer to errors in yr proposed crontab entries, that are either not there or not recognizable anymore. It's ok to correct a typo or a bad phrasing, but not an error if, in doing so, you take away the meaning of yr post. In that case yr readers cannot understand anymore what the prbm was. Am I wrong here ?

    – Cbhihe
    Jul 12 '16 at 6:32






  • 1





    @Cbhihe thanks for your comment. Your are absolutely right, I did edit the post once received Thomas W. comment and terdon answer and the question doesn't make sense anymore now. Sorry about that. I'm going to copy back linebreakes into the question so it will make sense.

    – user564658
    Jul 12 '16 at 14:12











  • This error happends when the volume of crontab file is full.

    – bokan
    Dec 6 '18 at 14:56
















5












5








5


0






I've installed a fresh Ubuntu 16.04 to replace my Windows OS.



I'm trying to setup cronjobs to run mangento 2.1 via Ampps softaculous. The software has been successfully installed (both ampps and magento) and it's running well.
I'm trying to setup a crontab but it seems there is an error on the first line second 25.



This is what I'm trying to add in to the crontab for the Ampps user, using the command sudo crontab -e -u ampps



* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/update/cron.php >> /usr/local/ampps/www/localshop.dev.dev/var/log/update.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev.dev/bin/magento setup:cron:run >> /usr/local/ampps/www/localshop.dev.dev/var/log/setup.cron.log


What am I doing wrong?



I followed an error message in magento 2.1 admin that referred to this troubleshoot link for the version 2.0
and to this configuration guide










share|improve this question
















I've installed a fresh Ubuntu 16.04 to replace my Windows OS.



I'm trying to setup cronjobs to run mangento 2.1 via Ampps softaculous. The software has been successfully installed (both ampps and magento) and it's running well.
I'm trying to setup a crontab but it seems there is an error on the first line second 25.



This is what I'm trying to add in to the crontab for the Ampps user, using the command sudo crontab -e -u ampps



* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev/update/cron.php >> /usr/local/ampps/www/localshop.dev.dev/var/log/update.cron.log
* * * * * /usr/local/ampps/php-5.6/etc
/usr/local/ampps/www/localshop.dev.dev/bin/magento setup:cron:run >> /usr/local/ampps/www/localshop.dev.dev/var/log/setup.cron.log


What am I doing wrong?



I followed an error message in magento 2.1 admin that referred to this troubleshoot link for the version 2.0
and to this configuration guide







cron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 1 '17 at 10:29









Zanna

51.4k13140243




51.4k13140243










asked Jul 10 '16 at 15:40









user564658user564658

43115




43115








  • 2





    First glance: you may have lines which have no * * * * * so cron can't interpret the items. Crontabs are line-break delimited to state "This task runs with the given configuration, and that task runs with a different one, etc.". Is this just a formatting screwup with your copy/paste or do the linebreaks actually exist between /usr/local/ampps/php-5.6/etc and the rest of the lines as the code-formatting shows?

    – Thomas Ward
    Jul 10 '16 at 15:50













  • Hey Thomas thanks about that, when you mentioned line break i did check the formating and it helped fix the crontab that has been now installed. I did also changed the format in 30 20 * * * and seems working now.

    – user564658
    Jul 10 '16 at 19:22













  • Hi, I understand the problem neither from yr post not from the given comments and answer. Have you modified yr post after receiving comments and perhaps after accepting the answer ? Comments and accepted answer both refer to errors in yr proposed crontab entries, that are either not there or not recognizable anymore. It's ok to correct a typo or a bad phrasing, but not an error if, in doing so, you take away the meaning of yr post. In that case yr readers cannot understand anymore what the prbm was. Am I wrong here ?

    – Cbhihe
    Jul 12 '16 at 6:32






  • 1





    @Cbhihe thanks for your comment. Your are absolutely right, I did edit the post once received Thomas W. comment and terdon answer and the question doesn't make sense anymore now. Sorry about that. I'm going to copy back linebreakes into the question so it will make sense.

    – user564658
    Jul 12 '16 at 14:12











  • This error happends when the volume of crontab file is full.

    – bokan
    Dec 6 '18 at 14:56
















  • 2





    First glance: you may have lines which have no * * * * * so cron can't interpret the items. Crontabs are line-break delimited to state "This task runs with the given configuration, and that task runs with a different one, etc.". Is this just a formatting screwup with your copy/paste or do the linebreaks actually exist between /usr/local/ampps/php-5.6/etc and the rest of the lines as the code-formatting shows?

    – Thomas Ward
    Jul 10 '16 at 15:50













  • Hey Thomas thanks about that, when you mentioned line break i did check the formating and it helped fix the crontab that has been now installed. I did also changed the format in 30 20 * * * and seems working now.

    – user564658
    Jul 10 '16 at 19:22













  • Hi, I understand the problem neither from yr post not from the given comments and answer. Have you modified yr post after receiving comments and perhaps after accepting the answer ? Comments and accepted answer both refer to errors in yr proposed crontab entries, that are either not there or not recognizable anymore. It's ok to correct a typo or a bad phrasing, but not an error if, in doing so, you take away the meaning of yr post. In that case yr readers cannot understand anymore what the prbm was. Am I wrong here ?

    – Cbhihe
    Jul 12 '16 at 6:32






  • 1





    @Cbhihe thanks for your comment. Your are absolutely right, I did edit the post once received Thomas W. comment and terdon answer and the question doesn't make sense anymore now. Sorry about that. I'm going to copy back linebreakes into the question so it will make sense.

    – user564658
    Jul 12 '16 at 14:12











  • This error happends when the volume of crontab file is full.

    – bokan
    Dec 6 '18 at 14:56










2




2





First glance: you may have lines which have no * * * * * so cron can't interpret the items. Crontabs are line-break delimited to state "This task runs with the given configuration, and that task runs with a different one, etc.". Is this just a formatting screwup with your copy/paste or do the linebreaks actually exist between /usr/local/ampps/php-5.6/etc and the rest of the lines as the code-formatting shows?

– Thomas Ward
Jul 10 '16 at 15:50







First glance: you may have lines which have no * * * * * so cron can't interpret the items. Crontabs are line-break delimited to state "This task runs with the given configuration, and that task runs with a different one, etc.". Is this just a formatting screwup with your copy/paste or do the linebreaks actually exist between /usr/local/ampps/php-5.6/etc and the rest of the lines as the code-formatting shows?

– Thomas Ward
Jul 10 '16 at 15:50















Hey Thomas thanks about that, when you mentioned line break i did check the formating and it helped fix the crontab that has been now installed. I did also changed the format in 30 20 * * * and seems working now.

– user564658
Jul 10 '16 at 19:22







Hey Thomas thanks about that, when you mentioned line break i did check the formating and it helped fix the crontab that has been now installed. I did also changed the format in 30 20 * * * and seems working now.

– user564658
Jul 10 '16 at 19:22















Hi, I understand the problem neither from yr post not from the given comments and answer. Have you modified yr post after receiving comments and perhaps after accepting the answer ? Comments and accepted answer both refer to errors in yr proposed crontab entries, that are either not there or not recognizable anymore. It's ok to correct a typo or a bad phrasing, but not an error if, in doing so, you take away the meaning of yr post. In that case yr readers cannot understand anymore what the prbm was. Am I wrong here ?

– Cbhihe
Jul 12 '16 at 6:32





Hi, I understand the problem neither from yr post not from the given comments and answer. Have you modified yr post after receiving comments and perhaps after accepting the answer ? Comments and accepted answer both refer to errors in yr proposed crontab entries, that are either not there or not recognizable anymore. It's ok to correct a typo or a bad phrasing, but not an error if, in doing so, you take away the meaning of yr post. In that case yr readers cannot understand anymore what the prbm was. Am I wrong here ?

– Cbhihe
Jul 12 '16 at 6:32




1




1





@Cbhihe thanks for your comment. Your are absolutely right, I did edit the post once received Thomas W. comment and terdon answer and the question doesn't make sense anymore now. Sorry about that. I'm going to copy back linebreakes into the question so it will make sense.

– user564658
Jul 12 '16 at 14:12





@Cbhihe thanks for your comment. Your are absolutely right, I did edit the post once received Thomas W. comment and terdon answer and the question doesn't make sense anymore now. Sorry about that. I'm going to copy back linebreakes into the question so it will make sense.

– user564658
Jul 12 '16 at 14:12













This error happends when the volume of crontab file is full.

– bokan
Dec 6 '18 at 14:56







This error happends when the volume of crontab file is full.

– bokan
Dec 6 '18 at 14:56












5 Answers
5






active

oldest

votes


















8














Each crontab line must start with a time at which the command should be run and then the command. The general format is:



Min Hour Day Month DayOfWeek Command


So, to run command at 10:15 every Sunday, you'd do:



15 10 * * 0 command


I'm not sure what your commands are, but you have lines that don't start with a time definition. I don't understand what lines like this are:



* * * * * /usr/local/ampps/php-5.6/etc


That's a time but no command. You're giving it a directory. And lines like this have commands but no time:



/usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log


So, make sure you follow the format and you should be fine. If this is not clear, edit your question and explain what commands you are trying to run.






share|improve this answer

































    2














    From my previous experience, it was due to a CR/LF character before the first cron line (since it was edited from Windows not Linux directly).
    I noticed and removed that char from a HEX editor.






    share|improve this answer





















    • 3





      You should expand on your answer with more details.

      – WinEunuuchs2Unix
      Jul 28 '17 at 2:28











    • If you see '-':1: bad minute, the - is /l. Linux uses LF while windows uses CR/LF. In other words, it would be trying to read the /l character as the first character of the command instead of being part of the new line character.

      – Erick Stone
      Jan 7 at 21:31



















    1














    This kind of error may also occur if you are trying to reset cron variables to empty values like this:



    MAILTO=me@example.com
    * * * * * do some stuff with error reporting
    MAILTO=
    * * * * * do another stuff too verbose to receive emails


    Note the empty line after MAILTO= at line 3. This will result in the message:



    crontab: installing new crontab
    "/tmp/crontab.AvDwzo":3: bad minute
    errors in crontab file, can't install.
    Do you want to retry the same edit?


    The correct way to reset MAILTO variable is to use empty quotes, like this:



    MAILTO=''


    Hope this helps.






    share|improve this answer

































      0














      The following command fixed my problem with this issue



      perl -pi -e 's|rn|n|' /var/spool/cron/root


      The problem was that Windows line separators (CRLF) were upsetting the Linux based cron. Changing the separators to be Linux line separators (LF) fixed the problem.






      share|improve this answer


























      • I tried this, it deleted the content of my crontab

        – bokan
        Dec 6 '18 at 12:45











      • It happend because the drive was full

        – bokan
        Dec 6 '18 at 14:54



















      0














      In my case (and it seems to be OP's case as well), the issue was that I had a new line in the command to be executed, something like this



      5 0 * * * some_command -some_param
      -another_param


      The overflowing line was of course interpreted as a new cron entry, and cron rightfully complained that the start of that line was not a valid minute identifier.






      share|improve this answer
























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        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',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f797047%2fhow-to-fix-bad-minute-error-while-installing-a-new-crontab%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        8














        Each crontab line must start with a time at which the command should be run and then the command. The general format is:



        Min Hour Day Month DayOfWeek Command


        So, to run command at 10:15 every Sunday, you'd do:



        15 10 * * 0 command


        I'm not sure what your commands are, but you have lines that don't start with a time definition. I don't understand what lines like this are:



        * * * * * /usr/local/ampps/php-5.6/etc


        That's a time but no command. You're giving it a directory. And lines like this have commands but no time:



        /usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log


        So, make sure you follow the format and you should be fine. If this is not clear, edit your question and explain what commands you are trying to run.






        share|improve this answer






























          8














          Each crontab line must start with a time at which the command should be run and then the command. The general format is:



          Min Hour Day Month DayOfWeek Command


          So, to run command at 10:15 every Sunday, you'd do:



          15 10 * * 0 command


          I'm not sure what your commands are, but you have lines that don't start with a time definition. I don't understand what lines like this are:



          * * * * * /usr/local/ampps/php-5.6/etc


          That's a time but no command. You're giving it a directory. And lines like this have commands but no time:



          /usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log


          So, make sure you follow the format and you should be fine. If this is not clear, edit your question and explain what commands you are trying to run.






          share|improve this answer




























            8












            8








            8







            Each crontab line must start with a time at which the command should be run and then the command. The general format is:



            Min Hour Day Month DayOfWeek Command


            So, to run command at 10:15 every Sunday, you'd do:



            15 10 * * 0 command


            I'm not sure what your commands are, but you have lines that don't start with a time definition. I don't understand what lines like this are:



            * * * * * /usr/local/ampps/php-5.6/etc


            That's a time but no command. You're giving it a directory. And lines like this have commands but no time:



            /usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log


            So, make sure you follow the format and you should be fine. If this is not clear, edit your question and explain what commands you are trying to run.






            share|improve this answer















            Each crontab line must start with a time at which the command should be run and then the command. The general format is:



            Min Hour Day Month DayOfWeek Command


            So, to run command at 10:15 every Sunday, you'd do:



            15 10 * * 0 command


            I'm not sure what your commands are, but you have lines that don't start with a time definition. I don't understand what lines like this are:



            * * * * * /usr/local/ampps/php-5.6/etc


            That's a time but no command. You're giving it a directory. And lines like this have commands but no time:



            /usr/local/ampps/www/localshop.dev/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/local/ampps/www/localshop.dev/var/log/magento.cron.log


            So, make sure you follow the format and you should be fine. If this is not clear, edit your question and explain what commands you are trying to run.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 9 '16 at 23:40









            user564658

            43115




            43115










            answered Jul 10 '16 at 16:48









            terdonterdon

            67.9k13140223




            67.9k13140223

























                2














                From my previous experience, it was due to a CR/LF character before the first cron line (since it was edited from Windows not Linux directly).
                I noticed and removed that char from a HEX editor.






                share|improve this answer





















                • 3





                  You should expand on your answer with more details.

                  – WinEunuuchs2Unix
                  Jul 28 '17 at 2:28











                • If you see '-':1: bad minute, the - is /l. Linux uses LF while windows uses CR/LF. In other words, it would be trying to read the /l character as the first character of the command instead of being part of the new line character.

                  – Erick Stone
                  Jan 7 at 21:31
















                2














                From my previous experience, it was due to a CR/LF character before the first cron line (since it was edited from Windows not Linux directly).
                I noticed and removed that char from a HEX editor.






                share|improve this answer





















                • 3





                  You should expand on your answer with more details.

                  – WinEunuuchs2Unix
                  Jul 28 '17 at 2:28











                • If you see '-':1: bad minute, the - is /l. Linux uses LF while windows uses CR/LF. In other words, it would be trying to read the /l character as the first character of the command instead of being part of the new line character.

                  – Erick Stone
                  Jan 7 at 21:31














                2












                2








                2







                From my previous experience, it was due to a CR/LF character before the first cron line (since it was edited from Windows not Linux directly).
                I noticed and removed that char from a HEX editor.






                share|improve this answer















                From my previous experience, it was due to a CR/LF character before the first cron line (since it was edited from Windows not Linux directly).
                I noticed and removed that char from a HEX editor.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 15 '18 at 18:15

























                answered Jul 27 '17 at 16:25









                robregonmrobregonm

                1214




                1214








                • 3





                  You should expand on your answer with more details.

                  – WinEunuuchs2Unix
                  Jul 28 '17 at 2:28











                • If you see '-':1: bad minute, the - is /l. Linux uses LF while windows uses CR/LF. In other words, it would be trying to read the /l character as the first character of the command instead of being part of the new line character.

                  – Erick Stone
                  Jan 7 at 21:31














                • 3





                  You should expand on your answer with more details.

                  – WinEunuuchs2Unix
                  Jul 28 '17 at 2:28











                • If you see '-':1: bad minute, the - is /l. Linux uses LF while windows uses CR/LF. In other words, it would be trying to read the /l character as the first character of the command instead of being part of the new line character.

                  – Erick Stone
                  Jan 7 at 21:31








                3




                3





                You should expand on your answer with more details.

                – WinEunuuchs2Unix
                Jul 28 '17 at 2:28





                You should expand on your answer with more details.

                – WinEunuuchs2Unix
                Jul 28 '17 at 2:28













                If you see '-':1: bad minute, the - is /l. Linux uses LF while windows uses CR/LF. In other words, it would be trying to read the /l character as the first character of the command instead of being part of the new line character.

                – Erick Stone
                Jan 7 at 21:31





                If you see '-':1: bad minute, the - is /l. Linux uses LF while windows uses CR/LF. In other words, it would be trying to read the /l character as the first character of the command instead of being part of the new line character.

                – Erick Stone
                Jan 7 at 21:31











                1














                This kind of error may also occur if you are trying to reset cron variables to empty values like this:



                MAILTO=me@example.com
                * * * * * do some stuff with error reporting
                MAILTO=
                * * * * * do another stuff too verbose to receive emails


                Note the empty line after MAILTO= at line 3. This will result in the message:



                crontab: installing new crontab
                "/tmp/crontab.AvDwzo":3: bad minute
                errors in crontab file, can't install.
                Do you want to retry the same edit?


                The correct way to reset MAILTO variable is to use empty quotes, like this:



                MAILTO=''


                Hope this helps.






                share|improve this answer






























                  1














                  This kind of error may also occur if you are trying to reset cron variables to empty values like this:



                  MAILTO=me@example.com
                  * * * * * do some stuff with error reporting
                  MAILTO=
                  * * * * * do another stuff too verbose to receive emails


                  Note the empty line after MAILTO= at line 3. This will result in the message:



                  crontab: installing new crontab
                  "/tmp/crontab.AvDwzo":3: bad minute
                  errors in crontab file, can't install.
                  Do you want to retry the same edit?


                  The correct way to reset MAILTO variable is to use empty quotes, like this:



                  MAILTO=''


                  Hope this helps.






                  share|improve this answer




























                    1












                    1








                    1







                    This kind of error may also occur if you are trying to reset cron variables to empty values like this:



                    MAILTO=me@example.com
                    * * * * * do some stuff with error reporting
                    MAILTO=
                    * * * * * do another stuff too verbose to receive emails


                    Note the empty line after MAILTO= at line 3. This will result in the message:



                    crontab: installing new crontab
                    "/tmp/crontab.AvDwzo":3: bad minute
                    errors in crontab file, can't install.
                    Do you want to retry the same edit?


                    The correct way to reset MAILTO variable is to use empty quotes, like this:



                    MAILTO=''


                    Hope this helps.






                    share|improve this answer















                    This kind of error may also occur if you are trying to reset cron variables to empty values like this:



                    MAILTO=me@example.com
                    * * * * * do some stuff with error reporting
                    MAILTO=
                    * * * * * do another stuff too verbose to receive emails


                    Note the empty line after MAILTO= at line 3. This will result in the message:



                    crontab: installing new crontab
                    "/tmp/crontab.AvDwzo":3: bad minute
                    errors in crontab file, can't install.
                    Do you want to retry the same edit?


                    The correct way to reset MAILTO variable is to use empty quotes, like this:



                    MAILTO=''


                    Hope this helps.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Sep 1 '17 at 10:27









                    Zanna

                    51.4k13140243




                    51.4k13140243










                    answered Sep 1 '17 at 10:16









                    ob-ivanob-ivan

                    1112




                    1112























                        0














                        The following command fixed my problem with this issue



                        perl -pi -e 's|rn|n|' /var/spool/cron/root


                        The problem was that Windows line separators (CRLF) were upsetting the Linux based cron. Changing the separators to be Linux line separators (LF) fixed the problem.






                        share|improve this answer


























                        • I tried this, it deleted the content of my crontab

                          – bokan
                          Dec 6 '18 at 12:45











                        • It happend because the drive was full

                          – bokan
                          Dec 6 '18 at 14:54
















                        0














                        The following command fixed my problem with this issue



                        perl -pi -e 's|rn|n|' /var/spool/cron/root


                        The problem was that Windows line separators (CRLF) were upsetting the Linux based cron. Changing the separators to be Linux line separators (LF) fixed the problem.






                        share|improve this answer


























                        • I tried this, it deleted the content of my crontab

                          – bokan
                          Dec 6 '18 at 12:45











                        • It happend because the drive was full

                          – bokan
                          Dec 6 '18 at 14:54














                        0












                        0








                        0







                        The following command fixed my problem with this issue



                        perl -pi -e 's|rn|n|' /var/spool/cron/root


                        The problem was that Windows line separators (CRLF) were upsetting the Linux based cron. Changing the separators to be Linux line separators (LF) fixed the problem.






                        share|improve this answer















                        The following command fixed my problem with this issue



                        perl -pi -e 's|rn|n|' /var/spool/cron/root


                        The problem was that Windows line separators (CRLF) were upsetting the Linux based cron. Changing the separators to be Linux line separators (LF) fixed the problem.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Jul 31 '18 at 5:54









                        pomsky

                        33.7k11105138




                        33.7k11105138










                        answered Jul 31 '18 at 5:36









                        Derek HazellDerek Hazell

                        1




                        1













                        • I tried this, it deleted the content of my crontab

                          – bokan
                          Dec 6 '18 at 12:45











                        • It happend because the drive was full

                          – bokan
                          Dec 6 '18 at 14:54



















                        • I tried this, it deleted the content of my crontab

                          – bokan
                          Dec 6 '18 at 12:45











                        • It happend because the drive was full

                          – bokan
                          Dec 6 '18 at 14:54

















                        I tried this, it deleted the content of my crontab

                        – bokan
                        Dec 6 '18 at 12:45





                        I tried this, it deleted the content of my crontab

                        – bokan
                        Dec 6 '18 at 12:45













                        It happend because the drive was full

                        – bokan
                        Dec 6 '18 at 14:54





                        It happend because the drive was full

                        – bokan
                        Dec 6 '18 at 14:54











                        0














                        In my case (and it seems to be OP's case as well), the issue was that I had a new line in the command to be executed, something like this



                        5 0 * * * some_command -some_param
                        -another_param


                        The overflowing line was of course interpreted as a new cron entry, and cron rightfully complained that the start of that line was not a valid minute identifier.






                        share|improve this answer




























                          0














                          In my case (and it seems to be OP's case as well), the issue was that I had a new line in the command to be executed, something like this



                          5 0 * * * some_command -some_param
                          -another_param


                          The overflowing line was of course interpreted as a new cron entry, and cron rightfully complained that the start of that line was not a valid minute identifier.






                          share|improve this answer


























                            0












                            0








                            0







                            In my case (and it seems to be OP's case as well), the issue was that I had a new line in the command to be executed, something like this



                            5 0 * * * some_command -some_param
                            -another_param


                            The overflowing line was of course interpreted as a new cron entry, and cron rightfully complained that the start of that line was not a valid minute identifier.






                            share|improve this answer













                            In my case (and it seems to be OP's case as well), the issue was that I had a new line in the command to be executed, something like this



                            5 0 * * * some_command -some_param
                            -another_param


                            The overflowing line was of course interpreted as a new cron entry, and cron rightfully complained that the start of that line was not a valid minute identifier.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 29 at 14:39









                            ZoltánZoltán

                            2501216




                            2501216






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f797047%2fhow-to-fix-bad-minute-error-while-installing-a-new-crontab%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                How did Captain America manage to do this?

                                迪纳利

                                南乌拉尔铁路局