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?
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
add a comment |
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
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 tocd /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
add a comment |
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
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
debian cron
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 tocd /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
add a comment |
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 tocd /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
add a comment |
6 Answers
6
active
oldest
votes
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
)
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 bycrontab -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 addroot
in the file - justcrontab -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 toetc/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
|
show 3 more comments
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.
add a comment |
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
.
thanks - in this case the crontab is set in the context of aDockerfile
so I can't really docrontab -e
- but it's a useful information anyway
– Jivan
Jul 16 '16 at 19:35
add a comment |
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
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
add a comment |
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.
add a comment |
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
.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
)
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 bycrontab -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 addroot
in the file - justcrontab -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 toetc/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
|
show 3 more comments
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
)
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 bycrontab -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 addroot
in the file - justcrontab -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 toetc/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
|
show 3 more comments
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
)
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
)
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 bycrontab -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 addroot
in the file - justcrontab -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 toetc/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
|
show 3 more comments
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 bycrontab -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 addroot
in the file - justcrontab -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 toetc/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
|
show 3 more comments
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 23 '18 at 10:01
slac1024slac1024
311
311
add a comment |
add a comment |
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
.
thanks - in this case the crontab is set in the context of aDockerfile
so I can't really docrontab -e
- but it's a useful information anyway
– Jivan
Jul 16 '16 at 19:35
add a comment |
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
.
thanks - in this case the crontab is set in the context of aDockerfile
so I can't really docrontab -e
- but it's a useful information anyway
– Jivan
Jul 16 '16 at 19:35
add a comment |
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
.
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
.
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 aDockerfile
so I can't really docrontab -e
- but it's a useful information anyway
– Jivan
Jul 16 '16 at 19:35
add a comment |
thanks - in this case the crontab is set in the context of aDockerfile
so I can't really docrontab -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
add a comment |
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
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
add a comment |
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
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
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited Dec 20 '16 at 18:46
HalosGhost
3,76392236
3,76392236
answered Dec 20 '16 at 18:15
James NelsonJames Nelson
112
112
add a comment |
add a comment |
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
.
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
add a comment |
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
.
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
add a comment |
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
.
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
.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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 tocd /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