Crontab never running while in /etc/cron.d2019 Community Moderator Electionfind * looks for a file named “*” on Debian but not on RHELCron only occasionally sends e-mail on output and errorsDebian jessie volume group not found and can't boothow to update cURL openssl version for paypal IPNCron jobs run 1 hour off, in total disagreement with system timesWho starts unattended-upgrades?Trying to run a python script as a service using systemdWhat is the difference between cron.d (as in /etc/cron.d/) and crontab?Debian Stretch post-up change gateway to second interfaceHow are files under /etc/cron.d used?

Why I don't get the wanted width of tcbox?

Was World War I a war of liberals against authoritarians?

How are passwords stolen from companies if they only store hashes?

CLI: Get information Ubuntu releases

Isn't the word "experience" wrongly used in this context?

When should a starting writer get his own webpage?

Asserting that Atheism and Theism are both faith based positions

Justification failure in beamer enumerate list

Why doesn't the fusion process of the sun speed up?

PTIJ: At the Passover Seder, is one allowed to speak more than once during Maggid?

What is the tangent at a sharp point on a curve?

Why do I have a large white artefact on the rendered image?

What (if any) is the reason to buy in small local stores?

How can an organ that provides biological immortality be unable to regenerate?

Why is indicated airspeed rather than ground speed used during the takeoff roll?

Gauss brackets with double vertical lines

Animating wave motion in water

How old is Nick Fury?

Turning a hard to access nut?

PTIJ: Which Dr. Seuss books should one obtain?

Why is participating in the European Parliamentary elections used as a threat?

The English Debate

Homology of the fiber

Would mining huge amounts of resources on the Moon change its orbit?



Crontab never running while in /etc/cron.d



2019 Community Moderator Electionfind * looks for a file named “*” on Debian but not on RHELCron only occasionally sends e-mail on output and errorsDebian jessie volume group not found and can't boothow to update cURL openssl version for paypal IPNCron jobs run 1 hour off, in total disagreement with system timesWho starts unattended-upgrades?Trying to run a python script as a service using systemdWhat is the difference between cron.d (as in /etc/cron.d/) and crontab?Debian Stretch post-up change gateway to second interfaceHow are files under /etc/cron.d used?










20















Here's what I did on Debian Jessie:



  • install cron via apt-get install cron

  • put a backup_crontab file in /etc/cron.d/

However the task is never running.



Here are some outputs:



/# crontab -l
no crontab for root

/# cd /etc/cron.d && ls
backup_crontab

/etc/cron.d# cat backup_crontab
0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


Is there something to do to activate a particular crontab, or to activate the cron "service" in itself?










share|improve this question

















  • 4





    What if it's running and failing with an error you don't get to see because you're redirecting all output to /dev/null? :)

    – tink
    Jul 16 '16 at 19:33











  • @tink is it possible to append the output to the end of a file instead?

    – Jivan
    Jul 16 '16 at 19:34







  • 1





    sure is; 0,15,30,45 * * * * /backup.sh >>/tmp/testing_cron.out 2>&1

    – tink
    Jul 16 '16 at 19:36











  • @Jivan, just a small note: ls /etc/cron.d is equivalent to cd /etc/cron.d && ls in terms of output. The only difference is the working directory won't change.

    – Drew Chapin
    Apr 3 '18 at 19:50















20















Here's what I did on Debian Jessie:



  • install cron via apt-get install cron

  • put a backup_crontab file in /etc/cron.d/

However the task is never running.



Here are some outputs:



/# crontab -l
no crontab for root

/# cd /etc/cron.d && ls
backup_crontab

/etc/cron.d# cat backup_crontab
0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


Is there something to do to activate a particular crontab, or to activate the cron "service" in itself?










share|improve this question

















  • 4





    What if it's running and failing with an error you don't get to see because you're redirecting all output to /dev/null? :)

    – tink
    Jul 16 '16 at 19:33











  • @tink is it possible to append the output to the end of a file instead?

    – Jivan
    Jul 16 '16 at 19:34







  • 1





    sure is; 0,15,30,45 * * * * /backup.sh >>/tmp/testing_cron.out 2>&1

    – tink
    Jul 16 '16 at 19:36











  • @Jivan, just a small note: ls /etc/cron.d is equivalent to cd /etc/cron.d && ls in terms of output. The only difference is the working directory won't change.

    – Drew Chapin
    Apr 3 '18 at 19:50













20












20








20


1






Here's what I did on Debian Jessie:



  • install cron via apt-get install cron

  • put a backup_crontab file in /etc/cron.d/

However the task is never running.



Here are some outputs:



/# crontab -l
no crontab for root

/# cd /etc/cron.d && ls
backup_crontab

/etc/cron.d# cat backup_crontab
0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


Is there something to do to activate a particular crontab, or to activate the cron "service" in itself?










share|improve this question














Here's what I did on Debian Jessie:



  • install cron via apt-get install cron

  • put a backup_crontab file in /etc/cron.d/

However the task is never running.



Here are some outputs:



/# crontab -l
no crontab for root

/# cd /etc/cron.d && ls
backup_crontab

/etc/cron.d# cat backup_crontab
0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


Is there something to do to activate a particular crontab, or to activate the cron "service" in itself?







debian cron






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 16 '16 at 18:43









JivanJivan

203126




203126







  • 4





    What if it's running and failing with an error you don't get to see because you're redirecting all output to /dev/null? :)

    – tink
    Jul 16 '16 at 19:33











  • @tink is it possible to append the output to the end of a file instead?

    – Jivan
    Jul 16 '16 at 19:34







  • 1





    sure is; 0,15,30,45 * * * * /backup.sh >>/tmp/testing_cron.out 2>&1

    – tink
    Jul 16 '16 at 19:36











  • @Jivan, just a small note: ls /etc/cron.d is equivalent to cd /etc/cron.d && ls in terms of output. The only difference is the working directory won't change.

    – Drew Chapin
    Apr 3 '18 at 19:50












  • 4





    What if it's running and failing with an error you don't get to see because you're redirecting all output to /dev/null? :)

    – tink
    Jul 16 '16 at 19:33











  • @tink is it possible to append the output to the end of a file instead?

    – Jivan
    Jul 16 '16 at 19:34







  • 1





    sure is; 0,15,30,45 * * * * /backup.sh >>/tmp/testing_cron.out 2>&1

    – tink
    Jul 16 '16 at 19:36











  • @Jivan, just a small note: ls /etc/cron.d is equivalent to cd /etc/cron.d && ls in terms of output. The only difference is the working directory won't change.

    – Drew Chapin
    Apr 3 '18 at 19:50







4




4





What if it's running and failing with an error you don't get to see because you're redirecting all output to /dev/null? :)

– tink
Jul 16 '16 at 19:33





What if it's running and failing with an error you don't get to see because you're redirecting all output to /dev/null? :)

– tink
Jul 16 '16 at 19:33













@tink is it possible to append the output to the end of a file instead?

– Jivan
Jul 16 '16 at 19:34






@tink is it possible to append the output to the end of a file instead?

– Jivan
Jul 16 '16 at 19:34





1




1





sure is; 0,15,30,45 * * * * /backup.sh >>/tmp/testing_cron.out 2>&1

– tink
Jul 16 '16 at 19:36





sure is; 0,15,30,45 * * * * /backup.sh >>/tmp/testing_cron.out 2>&1

– tink
Jul 16 '16 at 19:36













@Jivan, just a small note: ls /etc/cron.d is equivalent to cd /etc/cron.d && ls in terms of output. The only difference is the working directory won't change.

– Drew Chapin
Apr 3 '18 at 19:50





@Jivan, just a small note: ls /etc/cron.d is equivalent to cd /etc/cron.d && ls in terms of output. The only difference is the working directory won't change.

– Drew Chapin
Apr 3 '18 at 19:50










6 Answers
6






active

oldest

votes


















40














Files in /etc/cron.d need to also list the user that the job is to be run under.



i.e.



0,15,30,45 * * * * root /backup.sh >/dev/null 2>&1


You should also ensure the permissions and owner:group are set correctly (-rw-r--r-- and owned by root:root)






share|improve this answer


















  • 13





    crontab -l reports on cron entries in /var/spool/cron/crontabs/ - ie the per user crontabs. /etc/cron.d files are system crontabs and not reported by crontab -l.

    – Stephen Harris
    Jul 16 '16 at 19:30






  • 5





    Actually I mentioned that it was not working but I just realized that it is after having add root in the file - just crontab -l didn't mention it, as you explained why - thanks for your help

    – Jivan
    Jul 16 '16 at 19:38







  • 8





    it seems that also the filename has a role. In my case I had added to etc/cron.d a file with a dot in the middle of the name and the job was never executed until I renamed it

    – pic
    Apr 24 '17 at 11:57






  • 16





    same problem here, dashes "-" in filename, changing them to underscores "_" solved the problem, jobs ran immediately.

    – Rob
    Apr 27 '17 at 6:06






  • 1





    I also had a dash... what the.... why?! Anyway, thanks @Rob

    – Nikolay Dimitrov
    May 23 '18 at 4:23


















3














I think you probably just missing a necessary blank line from the end of your cron file. I had the same issue, but after checking everything listed here (user permissions, filename, cron version etc.), I realized that I did not have line break after the last entry in my /etc/cron.d/own_cron and that causes the entire file being ignored.






share|improve this answer






























    2














    If you're the only user on this computer, you might want to use just crontab -e. You'll be prompted to select an editor the first time you run the command. Then you can add this to it:



    0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


    If you change to a normal user account, you'll need to use sudo crontab -e to configure the scripts you want scheduled to run as root.



    crontab -l only displays the current crontab, once you set one up using crontab -e. If you have a cron file in /etc/cron.d/, it will not be displayed with crontab -l.



    You will also need to verify that your script is executable with: chmod +x /backup.sh.






    share|improve this answer

























    • thanks - in this case the crontab is set in the context of a Dockerfile so I can't really do crontab -e - but it's a useful information anyway

      – Jivan
      Jul 16 '16 at 19:35



















    2





    +100









    Another thing I've observed is that the file in /etc/cron.d cannot have an extension. In my particular case, I had a symbolic link:



    # my-job.crontab
    * * * * * root echo "my job is running!" >> /tmp/my-job.log

    $: ln -sf /home/me/my-job.crontab /etc/cron.d/
    # This did not work -> job would not run

    $: ln -sf /home/me/my-job.crontab /etc/cron.d/my-job
    # This did work -> job ran fine


    File name restriction are documented at run-part man page: http://manpages.ubuntu.com/manpages/xenial/man8/run-parts.8.html, one can pass
    an --regex option to override the file format.



    The default cron behavior however stayed without extensions, see comments under: https://bugs.launchpad.net/ubuntu/+source/debianutils/+bug/38022






    share|improve this answer

























    • Man, you saved my day!

      – elboletaire
      Oct 1 '18 at 12:19











    • This is correct on Ubuntu (maybe on all Debian-derived distros). On Amazon Linux (and maybe on all Redhat-derived distros), you can have a dot in the file name. Thank you Unix.SE.

      – Law29
      Mar 14 at 14:05












    • I just checked a pure Debian, and dots do not work there either. Dashes do work (unlike what a comment above says).

      – Law29
      Mar 14 at 14:34


















    1














    Check your version of cron.



    It seems that if you are using Dillon's crond, you don't need the user in a /etc/cron.d entry.



    I figured this out after nearly pulling out my remaining hair.



    I have a handful of entries that have been dropped in /etc/cron.d by various installs. After some investigation, I found one of them was working. It didn't have the user. So I took the user out of the others. And they began working.






    share|improve this answer
































      1














      For Cron from *bian distros (like Raspbian) you need to enable the -l parameter of the Cron daemon. That is advisable to do using /etc/default/cron config file, enabling the EXTRA_OPTS.






      share|improve this answer

























      • This was downvoted, but it is correct in some cases, although not explained. On Debian-based distros the -l option to the cron daemon authorizes an extended set of file names in the /etc/cron.d directory, so if the file is being silently ignored because there is a dot in it, then either "adding -l" or "removing dot" will correct the problem.

        – Law29
        Mar 14 at 16:35











      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',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f296347%2fcrontab-never-running-while-in-etc-cron-d%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      40














      Files in /etc/cron.d need to also list the user that the job is to be run under.



      i.e.



      0,15,30,45 * * * * root /backup.sh >/dev/null 2>&1


      You should also ensure the permissions and owner:group are set correctly (-rw-r--r-- and owned by root:root)






      share|improve this answer


















      • 13





        crontab -l reports on cron entries in /var/spool/cron/crontabs/ - ie the per user crontabs. /etc/cron.d files are system crontabs and not reported by crontab -l.

        – Stephen Harris
        Jul 16 '16 at 19:30






      • 5





        Actually I mentioned that it was not working but I just realized that it is after having add root in the file - just crontab -l didn't mention it, as you explained why - thanks for your help

        – Jivan
        Jul 16 '16 at 19:38







      • 8





        it seems that also the filename has a role. In my case I had added to etc/cron.d a file with a dot in the middle of the name and the job was never executed until I renamed it

        – pic
        Apr 24 '17 at 11:57






      • 16





        same problem here, dashes "-" in filename, changing them to underscores "_" solved the problem, jobs ran immediately.

        – Rob
        Apr 27 '17 at 6:06






      • 1





        I also had a dash... what the.... why?! Anyway, thanks @Rob

        – Nikolay Dimitrov
        May 23 '18 at 4:23















      40














      Files in /etc/cron.d need to also list the user that the job is to be run under.



      i.e.



      0,15,30,45 * * * * root /backup.sh >/dev/null 2>&1


      You should also ensure the permissions and owner:group are set correctly (-rw-r--r-- and owned by root:root)






      share|improve this answer


















      • 13





        crontab -l reports on cron entries in /var/spool/cron/crontabs/ - ie the per user crontabs. /etc/cron.d files are system crontabs and not reported by crontab -l.

        – Stephen Harris
        Jul 16 '16 at 19:30






      • 5





        Actually I mentioned that it was not working but I just realized that it is after having add root in the file - just crontab -l didn't mention it, as you explained why - thanks for your help

        – Jivan
        Jul 16 '16 at 19:38







      • 8





        it seems that also the filename has a role. In my case I had added to etc/cron.d a file with a dot in the middle of the name and the job was never executed until I renamed it

        – pic
        Apr 24 '17 at 11:57






      • 16





        same problem here, dashes "-" in filename, changing them to underscores "_" solved the problem, jobs ran immediately.

        – Rob
        Apr 27 '17 at 6:06






      • 1





        I also had a dash... what the.... why?! Anyway, thanks @Rob

        – Nikolay Dimitrov
        May 23 '18 at 4:23













      40












      40








      40







      Files in /etc/cron.d need to also list the user that the job is to be run under.



      i.e.



      0,15,30,45 * * * * root /backup.sh >/dev/null 2>&1


      You should also ensure the permissions and owner:group are set correctly (-rw-r--r-- and owned by root:root)






      share|improve this answer













      Files in /etc/cron.d need to also list the user that the job is to be run under.



      i.e.



      0,15,30,45 * * * * root /backup.sh >/dev/null 2>&1


      You should also ensure the permissions and owner:group are set correctly (-rw-r--r-- and owned by root:root)







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jul 16 '16 at 19:03









      Stephen HarrisStephen Harris

      26.5k34980




      26.5k34980







      • 13





        crontab -l reports on cron entries in /var/spool/cron/crontabs/ - ie the per user crontabs. /etc/cron.d files are system crontabs and not reported by crontab -l.

        – Stephen Harris
        Jul 16 '16 at 19:30






      • 5





        Actually I mentioned that it was not working but I just realized that it is after having add root in the file - just crontab -l didn't mention it, as you explained why - thanks for your help

        – Jivan
        Jul 16 '16 at 19:38







      • 8





        it seems that also the filename has a role. In my case I had added to etc/cron.d a file with a dot in the middle of the name and the job was never executed until I renamed it

        – pic
        Apr 24 '17 at 11:57






      • 16





        same problem here, dashes "-" in filename, changing them to underscores "_" solved the problem, jobs ran immediately.

        – Rob
        Apr 27 '17 at 6:06






      • 1





        I also had a dash... what the.... why?! Anyway, thanks @Rob

        – Nikolay Dimitrov
        May 23 '18 at 4:23












      • 13





        crontab -l reports on cron entries in /var/spool/cron/crontabs/ - ie the per user crontabs. /etc/cron.d files are system crontabs and not reported by crontab -l.

        – Stephen Harris
        Jul 16 '16 at 19:30






      • 5





        Actually I mentioned that it was not working but I just realized that it is after having add root in the file - just crontab -l didn't mention it, as you explained why - thanks for your help

        – Jivan
        Jul 16 '16 at 19:38







      • 8





        it seems that also the filename has a role. In my case I had added to etc/cron.d a file with a dot in the middle of the name and the job was never executed until I renamed it

        – pic
        Apr 24 '17 at 11:57






      • 16





        same problem here, dashes "-" in filename, changing them to underscores "_" solved the problem, jobs ran immediately.

        – Rob
        Apr 27 '17 at 6:06






      • 1





        I also had a dash... what the.... why?! Anyway, thanks @Rob

        – Nikolay Dimitrov
        May 23 '18 at 4:23







      13




      13





      crontab -l reports on cron entries in /var/spool/cron/crontabs/ - ie the per user crontabs. /etc/cron.d files are system crontabs and not reported by crontab -l.

      – Stephen Harris
      Jul 16 '16 at 19:30





      crontab -l reports on cron entries in /var/spool/cron/crontabs/ - ie the per user crontabs. /etc/cron.d files are system crontabs and not reported by crontab -l.

      – Stephen Harris
      Jul 16 '16 at 19:30




      5




      5





      Actually I mentioned that it was not working but I just realized that it is after having add root in the file - just crontab -l didn't mention it, as you explained why - thanks for your help

      – Jivan
      Jul 16 '16 at 19:38






      Actually I mentioned that it was not working but I just realized that it is after having add root in the file - just crontab -l didn't mention it, as you explained why - thanks for your help

      – Jivan
      Jul 16 '16 at 19:38





      8




      8





      it seems that also the filename has a role. In my case I had added to etc/cron.d a file with a dot in the middle of the name and the job was never executed until I renamed it

      – pic
      Apr 24 '17 at 11:57





      it seems that also the filename has a role. In my case I had added to etc/cron.d a file with a dot in the middle of the name and the job was never executed until I renamed it

      – pic
      Apr 24 '17 at 11:57




      16




      16





      same problem here, dashes "-" in filename, changing them to underscores "_" solved the problem, jobs ran immediately.

      – Rob
      Apr 27 '17 at 6:06





      same problem here, dashes "-" in filename, changing them to underscores "_" solved the problem, jobs ran immediately.

      – Rob
      Apr 27 '17 at 6:06




      1




      1





      I also had a dash... what the.... why?! Anyway, thanks @Rob

      – Nikolay Dimitrov
      May 23 '18 at 4:23





      I also had a dash... what the.... why?! Anyway, thanks @Rob

      – Nikolay Dimitrov
      May 23 '18 at 4:23













      3














      I think you probably just missing a necessary blank line from the end of your cron file. I had the same issue, but after checking everything listed here (user permissions, filename, cron version etc.), I realized that I did not have line break after the last entry in my /etc/cron.d/own_cron and that causes the entire file being ignored.






      share|improve this answer



























        3














        I think you probably just missing a necessary blank line from the end of your cron file. I had the same issue, but after checking everything listed here (user permissions, filename, cron version etc.), I realized that I did not have line break after the last entry in my /etc/cron.d/own_cron and that causes the entire file being ignored.






        share|improve this answer

























          3












          3








          3







          I think you probably just missing a necessary blank line from the end of your cron file. I had the same issue, but after checking everything listed here (user permissions, filename, cron version etc.), I realized that I did not have line break after the last entry in my /etc/cron.d/own_cron and that causes the entire file being ignored.






          share|improve this answer













          I think you probably just missing a necessary blank line from the end of your cron file. I had the same issue, but after checking everything listed here (user permissions, filename, cron version etc.), I realized that I did not have line break after the last entry in my /etc/cron.d/own_cron and that causes the entire file being ignored.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 23 '18 at 10:01









          slac1024slac1024

          311




          311





















              2














              If you're the only user on this computer, you might want to use just crontab -e. You'll be prompted to select an editor the first time you run the command. Then you can add this to it:



              0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


              If you change to a normal user account, you'll need to use sudo crontab -e to configure the scripts you want scheduled to run as root.



              crontab -l only displays the current crontab, once you set one up using crontab -e. If you have a cron file in /etc/cron.d/, it will not be displayed with crontab -l.



              You will also need to verify that your script is executable with: chmod +x /backup.sh.






              share|improve this answer

























              • thanks - in this case the crontab is set in the context of a Dockerfile so I can't really do crontab -e - but it's a useful information anyway

                – Jivan
                Jul 16 '16 at 19:35
















              2














              If you're the only user on this computer, you might want to use just crontab -e. You'll be prompted to select an editor the first time you run the command. Then you can add this to it:



              0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


              If you change to a normal user account, you'll need to use sudo crontab -e to configure the scripts you want scheduled to run as root.



              crontab -l only displays the current crontab, once you set one up using crontab -e. If you have a cron file in /etc/cron.d/, it will not be displayed with crontab -l.



              You will also need to verify that your script is executable with: chmod +x /backup.sh.






              share|improve this answer

























              • thanks - in this case the crontab is set in the context of a Dockerfile so I can't really do crontab -e - but it's a useful information anyway

                – Jivan
                Jul 16 '16 at 19:35














              2












              2








              2







              If you're the only user on this computer, you might want to use just crontab -e. You'll be prompted to select an editor the first time you run the command. Then you can add this to it:



              0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


              If you change to a normal user account, you'll need to use sudo crontab -e to configure the scripts you want scheduled to run as root.



              crontab -l only displays the current crontab, once you set one up using crontab -e. If you have a cron file in /etc/cron.d/, it will not be displayed with crontab -l.



              You will also need to verify that your script is executable with: chmod +x /backup.sh.






              share|improve this answer















              If you're the only user on this computer, you might want to use just crontab -e. You'll be prompted to select an editor the first time you run the command. Then you can add this to it:



              0,15,30,45 * * * * /backup.sh >/dev/null 2>&1


              If you change to a normal user account, you'll need to use sudo crontab -e to configure the scripts you want scheduled to run as root.



              crontab -l only displays the current crontab, once you set one up using crontab -e. If you have a cron file in /etc/cron.d/, it will not be displayed with crontab -l.



              You will also need to verify that your script is executable with: chmod +x /backup.sh.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jul 16 '16 at 19:30

























              answered Jul 16 '16 at 18:56









              clkclk

              1,6171821




              1,6171821












              • thanks - in this case the crontab is set in the context of a Dockerfile so I can't really do crontab -e - but it's a useful information anyway

                – Jivan
                Jul 16 '16 at 19:35


















              • thanks - in this case the crontab is set in the context of a Dockerfile so I can't really do crontab -e - but it's a useful information anyway

                – Jivan
                Jul 16 '16 at 19:35

















              thanks - in this case the crontab is set in the context of a Dockerfile so I can't really do crontab -e - but it's a useful information anyway

              – Jivan
              Jul 16 '16 at 19:35






              thanks - in this case the crontab is set in the context of a Dockerfile so I can't really do crontab -e - but it's a useful information anyway

              – Jivan
              Jul 16 '16 at 19:35












              2





              +100









              Another thing I've observed is that the file in /etc/cron.d cannot have an extension. In my particular case, I had a symbolic link:



              # my-job.crontab
              * * * * * root echo "my job is running!" >> /tmp/my-job.log

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/
              # This did not work -> job would not run

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/my-job
              # This did work -> job ran fine


              File name restriction are documented at run-part man page: http://manpages.ubuntu.com/manpages/xenial/man8/run-parts.8.html, one can pass
              an --regex option to override the file format.



              The default cron behavior however stayed without extensions, see comments under: https://bugs.launchpad.net/ubuntu/+source/debianutils/+bug/38022






              share|improve this answer

























              • Man, you saved my day!

                – elboletaire
                Oct 1 '18 at 12:19











              • This is correct on Ubuntu (maybe on all Debian-derived distros). On Amazon Linux (and maybe on all Redhat-derived distros), you can have a dot in the file name. Thank you Unix.SE.

                – Law29
                Mar 14 at 14:05












              • I just checked a pure Debian, and dots do not work there either. Dashes do work (unlike what a comment above says).

                – Law29
                Mar 14 at 14:34















              2





              +100









              Another thing I've observed is that the file in /etc/cron.d cannot have an extension. In my particular case, I had a symbolic link:



              # my-job.crontab
              * * * * * root echo "my job is running!" >> /tmp/my-job.log

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/
              # This did not work -> job would not run

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/my-job
              # This did work -> job ran fine


              File name restriction are documented at run-part man page: http://manpages.ubuntu.com/manpages/xenial/man8/run-parts.8.html, one can pass
              an --regex option to override the file format.



              The default cron behavior however stayed without extensions, see comments under: https://bugs.launchpad.net/ubuntu/+source/debianutils/+bug/38022






              share|improve this answer

























              • Man, you saved my day!

                – elboletaire
                Oct 1 '18 at 12:19











              • This is correct on Ubuntu (maybe on all Debian-derived distros). On Amazon Linux (and maybe on all Redhat-derived distros), you can have a dot in the file name. Thank you Unix.SE.

                – Law29
                Mar 14 at 14:05












              • I just checked a pure Debian, and dots do not work there either. Dashes do work (unlike what a comment above says).

                – Law29
                Mar 14 at 14:34













              2





              +100







              2





              +100



              2




              +100





              Another thing I've observed is that the file in /etc/cron.d cannot have an extension. In my particular case, I had a symbolic link:



              # my-job.crontab
              * * * * * root echo "my job is running!" >> /tmp/my-job.log

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/
              # This did not work -> job would not run

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/my-job
              # This did work -> job ran fine


              File name restriction are documented at run-part man page: http://manpages.ubuntu.com/manpages/xenial/man8/run-parts.8.html, one can pass
              an --regex option to override the file format.



              The default cron behavior however stayed without extensions, see comments under: https://bugs.launchpad.net/ubuntu/+source/debianutils/+bug/38022






              share|improve this answer















              Another thing I've observed is that the file in /etc/cron.d cannot have an extension. In my particular case, I had a symbolic link:



              # my-job.crontab
              * * * * * root echo "my job is running!" >> /tmp/my-job.log

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/
              # This did not work -> job would not run

              $: ln -sf /home/me/my-job.crontab /etc/cron.d/my-job
              # This did work -> job ran fine


              File name restriction are documented at run-part man page: http://manpages.ubuntu.com/manpages/xenial/man8/run-parts.8.html, one can pass
              an --regex option to override the file format.



              The default cron behavior however stayed without extensions, see comments under: https://bugs.launchpad.net/ubuntu/+source/debianutils/+bug/38022







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 12 hours ago









              daniel-balosh

              32




              32










              answered Aug 29 '18 at 15:19









              rodrigo-silveirarodrigo-silveira

              22113




              22113












              • Man, you saved my day!

                – elboletaire
                Oct 1 '18 at 12:19











              • This is correct on Ubuntu (maybe on all Debian-derived distros). On Amazon Linux (and maybe on all Redhat-derived distros), you can have a dot in the file name. Thank you Unix.SE.

                – Law29
                Mar 14 at 14:05












              • I just checked a pure Debian, and dots do not work there either. Dashes do work (unlike what a comment above says).

                – Law29
                Mar 14 at 14:34

















              • Man, you saved my day!

                – elboletaire
                Oct 1 '18 at 12:19











              • This is correct on Ubuntu (maybe on all Debian-derived distros). On Amazon Linux (and maybe on all Redhat-derived distros), you can have a dot in the file name. Thank you Unix.SE.

                – Law29
                Mar 14 at 14:05












              • I just checked a pure Debian, and dots do not work there either. Dashes do work (unlike what a comment above says).

                – Law29
                Mar 14 at 14:34
















              Man, you saved my day!

              – elboletaire
              Oct 1 '18 at 12:19





              Man, you saved my day!

              – elboletaire
              Oct 1 '18 at 12:19













              This is correct on Ubuntu (maybe on all Debian-derived distros). On Amazon Linux (and maybe on all Redhat-derived distros), you can have a dot in the file name. Thank you Unix.SE.

              – Law29
              Mar 14 at 14:05






              This is correct on Ubuntu (maybe on all Debian-derived distros). On Amazon Linux (and maybe on all Redhat-derived distros), you can have a dot in the file name. Thank you Unix.SE.

              – Law29
              Mar 14 at 14:05














              I just checked a pure Debian, and dots do not work there either. Dashes do work (unlike what a comment above says).

              – Law29
              Mar 14 at 14:34





              I just checked a pure Debian, and dots do not work there either. Dashes do work (unlike what a comment above says).

              – Law29
              Mar 14 at 14:34











              1














              Check your version of cron.



              It seems that if you are using Dillon's crond, you don't need the user in a /etc/cron.d entry.



              I figured this out after nearly pulling out my remaining hair.



              I have a handful of entries that have been dropped in /etc/cron.d by various installs. After some investigation, I found one of them was working. It didn't have the user. So I took the user out of the others. And they began working.






              share|improve this answer





























                1














                Check your version of cron.



                It seems that if you are using Dillon's crond, you don't need the user in a /etc/cron.d entry.



                I figured this out after nearly pulling out my remaining hair.



                I have a handful of entries that have been dropped in /etc/cron.d by various installs. After some investigation, I found one of them was working. It didn't have the user. So I took the user out of the others. And they began working.






                share|improve this answer



























                  1












                  1








                  1







                  Check your version of cron.



                  It seems that if you are using Dillon's crond, you don't need the user in a /etc/cron.d entry.



                  I figured this out after nearly pulling out my remaining hair.



                  I have a handful of entries that have been dropped in /etc/cron.d by various installs. After some investigation, I found one of them was working. It didn't have the user. So I took the user out of the others. And they began working.






                  share|improve this answer















                  Check your version of cron.



                  It seems that if you are using Dillon's crond, you don't need the user in a /etc/cron.d entry.



                  I figured this out after nearly pulling out my remaining hair.



                  I have a handful of entries that have been dropped in /etc/cron.d by various installs. After some investigation, I found one of them was working. It didn't have the user. So I took the user out of the others. And they began working.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 20 '16 at 18:46









                  HalosGhost

                  3,76392236




                  3,76392236










                  answered Dec 20 '16 at 18:15









                  James NelsonJames Nelson

                  112




                  112





















                      1














                      For Cron from *bian distros (like Raspbian) you need to enable the -l parameter of the Cron daemon. That is advisable to do using /etc/default/cron config file, enabling the EXTRA_OPTS.






                      share|improve this answer

























                      • This was downvoted, but it is correct in some cases, although not explained. On Debian-based distros the -l option to the cron daemon authorizes an extended set of file names in the /etc/cron.d directory, so if the file is being silently ignored because there is a dot in it, then either "adding -l" or "removing dot" will correct the problem.

                        – Law29
                        Mar 14 at 16:35
















                      1














                      For Cron from *bian distros (like Raspbian) you need to enable the -l parameter of the Cron daemon. That is advisable to do using /etc/default/cron config file, enabling the EXTRA_OPTS.






                      share|improve this answer

























                      • This was downvoted, but it is correct in some cases, although not explained. On Debian-based distros the -l option to the cron daemon authorizes an extended set of file names in the /etc/cron.d directory, so if the file is being silently ignored because there is a dot in it, then either "adding -l" or "removing dot" will correct the problem.

                        – Law29
                        Mar 14 at 16:35














                      1












                      1








                      1







                      For Cron from *bian distros (like Raspbian) you need to enable the -l parameter of the Cron daemon. That is advisable to do using /etc/default/cron config file, enabling the EXTRA_OPTS.






                      share|improve this answer















                      For Cron from *bian distros (like Raspbian) you need to enable the -l parameter of the Cron daemon. That is advisable to do using /etc/default/cron config file, enabling the EXTRA_OPTS.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited May 18 '17 at 8:56









                      phk

                      4,04852155




                      4,04852155










                      answered May 18 '17 at 7:43









                      touchwoodtouchwood

                      111




                      111












                      • This was downvoted, but it is correct in some cases, although not explained. On Debian-based distros the -l option to the cron daemon authorizes an extended set of file names in the /etc/cron.d directory, so if the file is being silently ignored because there is a dot in it, then either "adding -l" or "removing dot" will correct the problem.

                        – Law29
                        Mar 14 at 16:35


















                      • This was downvoted, but it is correct in some cases, although not explained. On Debian-based distros the -l option to the cron daemon authorizes an extended set of file names in the /etc/cron.d directory, so if the file is being silently ignored because there is a dot in it, then either "adding -l" or "removing dot" will correct the problem.

                        – Law29
                        Mar 14 at 16:35

















                      This was downvoted, but it is correct in some cases, although not explained. On Debian-based distros the -l option to the cron daemon authorizes an extended set of file names in the /etc/cron.d directory, so if the file is being silently ignored because there is a dot in it, then either "adding -l" or "removing dot" will correct the problem.

                      – Law29
                      Mar 14 at 16:35






                      This was downvoted, but it is correct in some cases, although not explained. On Debian-based distros the -l option to the cron daemon authorizes an extended set of file names in the /etc/cron.d directory, so if the file is being silently ignored because there is a dot in it, then either "adding -l" or "removing dot" will correct the problem.

                      – Law29
                      Mar 14 at 16:35


















                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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%2funix.stackexchange.com%2fquestions%2f296347%2fcrontab-never-running-while-in-etc-cron-d%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

                      getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                      Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                      Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.