cron job decides for itself if it wants to run












0















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 cronjob


  • internet access was not a factor



What could have made the cronjob suddenly decide to start working correctly?










share|improve this question




















  • 1





    Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?

    – user535733
    Feb 19 at 23:30











  • @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
    Feb 19 at 23:31






  • 1





    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
    Feb 20 at 2:25








  • 3





    @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
    Feb 20 at 3:55
















0















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 cronjob


  • internet access was not a factor



What could have made the cronjob suddenly decide to start working correctly?










share|improve this question




















  • 1





    Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?

    – user535733
    Feb 19 at 23:30











  • @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
    Feb 19 at 23:31






  • 1





    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
    Feb 20 at 2:25








  • 3





    @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
    Feb 20 at 3:55














0












0








0








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 cronjob


  • internet access was not a factor



What could have made the cronjob suddenly decide to start working correctly?










share|improve this question
















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 cronjob


  • internet access was not a factor



What could have made the cronjob suddenly decide to start working correctly?







18.04 bash scripts python cron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 20 at 18:31









pa4080

14.8k52872




14.8k52872










asked Feb 19 at 23:21









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
    Feb 19 at 23:30











  • @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
    Feb 19 at 23:31






  • 1





    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
    Feb 20 at 2:25








  • 3





    @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
    Feb 20 at 3:55














  • 1





    Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?

    – user535733
    Feb 19 at 23:30











  • @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
    Feb 19 at 23:31






  • 1





    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
    Feb 20 at 2:25








  • 3





    @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
    Feb 20 at 3:55








1




1





Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?

– user535733
Feb 19 at 23:30





Was your system, by chance, suspended/hibernated/off or simply logged off during the periods that the cronjobs did not run?

– user535733
Feb 19 at 23:30













@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
Feb 19 at 23:31





@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
Feb 19 at 23:31




1




1





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
Feb 20 at 2:25







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
Feb 20 at 2:25






3




3





@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
Feb 20 at 3:55





@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
Feb 20 at 3:55










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
});


}
});














draft saved

draft discarded


















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%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
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


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

But avoid



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

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


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




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1119675%2fcron-job-decides-for-itself-if-it-wants-to-run%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to make a Squid Proxy server?

Is this a new Fibonacci Identity?

Touch on Surface Book