Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to configure cron to run every minute #91

Closed
akashpatni opened this issue Aug 30, 2016 · 6 comments
Closed

Not able to configure cron to run every minute #91

akashpatni opened this issue Aug 30, 2016 · 6 comments

Comments

@akashpatni
Copy link

Hi,

I have used django-cron for setting up cron task for my project and I am able to run the scripts manually with command python manage.py runcrons and it is running for only one time. Now I want to run script for every minute and for that I have to use crontab -e and I have done in the same way as told in documentation but with no success.

  • * * * * source /home/ubuntu/.bashrc && /usr/bin/python && source /home/aakash/Project/project-name/src/api/bin/activate && python /home/aakash/Project/project-name/src/manage.py runcrons > /home/aakash/Project/cronjob.log

Can you please help me on that

@somacci
Copy link

somacci commented Sep 11, 2016

I have exactly same problem. If anyone can solutions. Please let me know it.

@ihoru
Copy link
Contributor

ihoru commented Sep 11, 2016

This will make your task execute every time you call manage.py runcrons:

schedule = Schedule(run_every_mins=0)

And if you want it to be executed every minute put 1 instead of 0.

@Lapeth
Copy link

Lapeth commented Dec 21, 2016

Setting run_every_mins=1 is error-prone: Consider that the crontab has us run every minute. If there is a slight difference in time offset on each run, the job might not be executed. Say the crontab executes at 08:00:00.02 and then at 08:01:00.01; there is less than a full minute between these timestamps, so django-cron passes on letting the job execute.

@tab-cmd
Copy link
Contributor

tab-cmd commented Jan 13, 2017

@akashpatni see documentation:

  1. Now everytime you run the management command python manage.py runcrons all the crons will run if required. Depending on the application the management command can be called from the Unix crontab as often as required. Every 5 minutes usually works for most of my applications, for example:

This is intended functionality

@sankethsj
Copy link

having the same issue. When I write "python manage.py runcrons", it works well for first time. But it wont run every minute. Help!

@JedrzejMaluszczak
Copy link
Contributor

@sankethsj use python manage.py cronloop instead.
You need to update django-cron to version 0.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants