cron job decides for itself if it wants to run (ubuntu 18.04)
I recently wrote a python script that reminds me via email if I need to move my car for the street sweeper mafia (and avoid a ticket). When I ran the script from the command line, it worked every time. So I added it to crontab -e
and tested it, it worked if I reset the date, time, etc.
I decided to run the cron tab every hour just for debug purposes:
1 * * * * python3 /home/robert/scripts/parking-project.py
On the night last week when the python script should have triggered the email, I was ready for the reminder. Instead there was no action.
I researched several cronjob articles to see how I messed up, but they all reinforced my original implementation decisions.
Eventually I got distracted and started working on other projects, but then today, out of the blue, my cronjob started working exactly like I expected it to.
more info
I had restarted the machine many times since implementing the job - so a reboot was not the answer.
my clock was correct
the script worked perfectly if you copied and pasted the command that was listed in crontab -e
journalctl -u cron.service
reported that there was never any attempt to run the cronjobinternet access was not a factor
What could have made the cronjob suddenly decide to start working correctly?
bash scripts python cron
add a comment |
I recently wrote a python script that reminds me via email if I need to move my car for the street sweeper mafia (and avoid a ticket). When I ran the script from the command line, it worked every time. So I added it to crontab -e
and tested it, it worked if I reset the date, time, etc.
I decided to run the cron tab every hour just for debug purposes:
1 * * * * python3 /home/robert/scripts/parking-project.py
On the night last week when the python script should have triggered the email, I was ready for the reminder. Instead there was no action.
I researched several cronjob articles to see how I messed up, but they all reinforced my original implementation decisions.
Eventually I got distracted and started working on other projects, but then today, out of the blue, my cronjob started working exactly like I expected it to.
more info
I had restarted the machine many times since implementing the job - so a reboot was not the answer.
my clock was correct
the script worked perfectly if you copied and pasted the command that was listed in crontab -e
journalctl -u cron.service
reported that there was never any attempt to run the cronjobinternet access was not a factor
What could have made the cronjob suddenly decide to start working correctly?
bash scripts python cron
1
Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?
– user535733
7 hours ago
@user535733, yes, but not always. There were plenty of times when it should have run when it was online but didn't. I don't think this was a factor, but thank you for jumping in.
– Robert Baker
7 hours ago
wouldn't1 * * * *
mean the first minute of every hour? Remember, the notation is MM HH, not HH MM. Some versions of cron also require a username such as00 01 * * * root /home/robert/scripts/parking-project.py
. My server performs a bulk processing of security footage with a crontab, and it looks like this (ubuntu 16.04)30 2 * * * root bash /mnt/array0/porch/process.sh
– Minty
4 hours ago
@Minty OP said "run [...] every hour", so that line is OK. The user crontab edited usingcrontab -e
doesn't require a username (those commands run as your user). The username is required in system crontab files (/etc/cronatb
,/etc/cron.d/*
).
– Olorin
3 hours ago
add a comment |
I recently wrote a python script that reminds me via email if I need to move my car for the street sweeper mafia (and avoid a ticket). When I ran the script from the command line, it worked every time. So I added it to crontab -e
and tested it, it worked if I reset the date, time, etc.
I decided to run the cron tab every hour just for debug purposes:
1 * * * * python3 /home/robert/scripts/parking-project.py
On the night last week when the python script should have triggered the email, I was ready for the reminder. Instead there was no action.
I researched several cronjob articles to see how I messed up, but they all reinforced my original implementation decisions.
Eventually I got distracted and started working on other projects, but then today, out of the blue, my cronjob started working exactly like I expected it to.
more info
I had restarted the machine many times since implementing the job - so a reboot was not the answer.
my clock was correct
the script worked perfectly if you copied and pasted the command that was listed in crontab -e
journalctl -u cron.service
reported that there was never any attempt to run the cronjobinternet access was not a factor
What could have made the cronjob suddenly decide to start working correctly?
bash scripts python cron
I recently wrote a python script that reminds me via email if I need to move my car for the street sweeper mafia (and avoid a ticket). When I ran the script from the command line, it worked every time. So I added it to crontab -e
and tested it, it worked if I reset the date, time, etc.
I decided to run the cron tab every hour just for debug purposes:
1 * * * * python3 /home/robert/scripts/parking-project.py
On the night last week when the python script should have triggered the email, I was ready for the reminder. Instead there was no action.
I researched several cronjob articles to see how I messed up, but they all reinforced my original implementation decisions.
Eventually I got distracted and started working on other projects, but then today, out of the blue, my cronjob started working exactly like I expected it to.
more info
I had restarted the machine many times since implementing the job - so a reboot was not the answer.
my clock was correct
the script worked perfectly if you copied and pasted the command that was listed in crontab -e
journalctl -u cron.service
reported that there was never any attempt to run the cronjobinternet access was not a factor
What could have made the cronjob suddenly decide to start working correctly?
bash scripts python cron
bash scripts python cron
edited 3 hours ago
Olorin
2,433821
2,433821
asked 7 hours ago
Robert BakerRobert Baker
8210
8210
1
Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?
– user535733
7 hours ago
@user535733, yes, but not always. There were plenty of times when it should have run when it was online but didn't. I don't think this was a factor, but thank you for jumping in.
– Robert Baker
7 hours ago
wouldn't1 * * * *
mean the first minute of every hour? Remember, the notation is MM HH, not HH MM. Some versions of cron also require a username such as00 01 * * * root /home/robert/scripts/parking-project.py
. My server performs a bulk processing of security footage with a crontab, and it looks like this (ubuntu 16.04)30 2 * * * root bash /mnt/array0/porch/process.sh
– Minty
4 hours ago
@Minty OP said "run [...] every hour", so that line is OK. The user crontab edited usingcrontab -e
doesn't require a username (those commands run as your user). The username is required in system crontab files (/etc/cronatb
,/etc/cron.d/*
).
– Olorin
3 hours ago
add a comment |
1
Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?
– user535733
7 hours ago
@user535733, yes, but not always. There were plenty of times when it should have run when it was online but didn't. I don't think this was a factor, but thank you for jumping in.
– Robert Baker
7 hours ago
wouldn't1 * * * *
mean the first minute of every hour? Remember, the notation is MM HH, not HH MM. Some versions of cron also require a username such as00 01 * * * root /home/robert/scripts/parking-project.py
. My server performs a bulk processing of security footage with a crontab, and it looks like this (ubuntu 16.04)30 2 * * * root bash /mnt/array0/porch/process.sh
– Minty
4 hours ago
@Minty OP said "run [...] every hour", so that line is OK. The user crontab edited usingcrontab -e
doesn't require a username (those commands run as your user). The username is required in system crontab files (/etc/cronatb
,/etc/cron.d/*
).
– Olorin
3 hours ago
1
1
Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?
– user535733
7 hours ago
Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?
– user535733
7 hours ago
@user535733, yes, but not always. There were plenty of times when it should have run when it was online but didn't. I don't think this was a factor, but thank you for jumping in.
– Robert Baker
7 hours ago
@user535733, yes, but not always. There were plenty of times when it should have run when it was online but didn't. I don't think this was a factor, but thank you for jumping in.
– Robert Baker
7 hours ago
wouldn't
1 * * * *
mean the first minute of every hour? Remember, the notation is MM HH, not HH MM. Some versions of cron also require a username such as 00 01 * * * root /home/robert/scripts/parking-project.py
. My server performs a bulk processing of security footage with a crontab, and it looks like this (ubuntu 16.04) 30 2 * * * root bash /mnt/array0/porch/process.sh
– Minty
4 hours ago
wouldn't
1 * * * *
mean the first minute of every hour? Remember, the notation is MM HH, not HH MM. Some versions of cron also require a username such as 00 01 * * * root /home/robert/scripts/parking-project.py
. My server performs a bulk processing of security footage with a crontab, and it looks like this (ubuntu 16.04) 30 2 * * * root bash /mnt/array0/porch/process.sh
– Minty
4 hours ago
@Minty OP said "run [...] every hour", so that line is OK. The user crontab edited using
crontab -e
doesn't require a username (those commands run as your user). The username is required in system crontab files (/etc/cronatb
, /etc/cron.d/*
).– Olorin
3 hours ago
@Minty OP said "run [...] every hour", so that line is OK. The user crontab edited using
crontab -e
doesn't require a username (those commands run as your user). The username is required in system crontab files (/etc/cronatb
, /etc/cron.d/*
).– Olorin
3 hours ago
add a comment |
0
active
oldest
votes
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
});
}
});
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%2faskubuntu.com%2fquestions%2f1119675%2fcron-job-decides-for-itself-if-it-wants-to-run-ubuntu-18-04%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2faskubuntu.com%2fquestions%2f1119675%2fcron-job-decides-for-itself-if-it-wants-to-run-ubuntu-18-04%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
1
Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?
– user535733
7 hours ago
@user535733, yes, but not always. There were plenty of times when it should have run when it was online but didn't. I don't think this was a factor, but thank you for jumping in.
– Robert Baker
7 hours ago
wouldn't
1 * * * *
mean the first minute of every hour? Remember, the notation is MM HH, not HH MM. Some versions of cron also require a username such as00 01 * * * root /home/robert/scripts/parking-project.py
. My server performs a bulk processing of security footage with a crontab, and it looks like this (ubuntu 16.04)30 2 * * * root bash /mnt/array0/porch/process.sh
– Minty
4 hours ago
@Minty OP said "run [...] every hour", so that line is OK. The user crontab edited using
crontab -e
doesn't require a username (those commands run as your user). The username is required in system crontab files (/etc/cronatb
,/etc/cron.d/*
).– Olorin
3 hours ago