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

Cronjob RUN_EVERY_MINS=1 not actually running every minute #112

Closed
jeremych1000 opened this issue Mar 12, 2017 · 3 comments
Closed

Cronjob RUN_EVERY_MINS=1 not actually running every minute #112

jeremych1000 opened this issue Mar 12, 2017 · 3 comments

Comments

@jeremych1000
Copy link

jeremych1000 commented Mar 12, 2017

Not sure why the cronjob isn't being run every minute :/ sometimes it does, sometimes it doesn't.

I saw #91 (comment) but is there any solution to this?

Any other information I can provide?
Django running on a raspberry pi, client running ubuntu 16.

Django console

2017-03-12 01:13:02,042 [INFO] django.server: "POST /bootstrap/keep_alive/ HTTP/1.1" 200 20
2017-03-12 01:15:02,181 [INFO] django.server: "POST /bootstrap/keep_alive/ HTTP/1.1" 200 20
2017-03-12 01:17:02,458 [INFO] django.server: "POST /bootstrap/keep_alive/ HTTP/1.1" 200 20
2017-03-12 01:19:01,640 [INFO] django.server: "POST /bootstrap/keep_alive/ HTTP/1.1" 200 20
2017-03-12 01:20:02,290 [INFO] django.server: "POST /bootstrap/keep_alive/ HTTP/1.1" 200 20

Client cronjob log using grep CRON /var/log/syslog

Mar 11 17:13:01 ubuntu CRON[5962]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)
Mar 11 17:13:02 ubuntu CRON[5961]: (CRON) info (No MTA installed, discarding output)
Mar 11 17:14:01 ubuntu CRON[5998]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)
Mar 11 17:15:01 ubuntu CRON[6004]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)
Mar 11 17:16:01 ubuntu CRON[6010]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)
Mar 11 17:17:01 ubuntu CRON[6032]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Mar 11 17:17:01 ubuntu CRON[6034]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)
Mar 11 17:18:01 ubuntu CRON[6044]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)
Mar 11 17:19:01 ubuntu CRON[6062]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)
Mar 11 17:20:01 ubuntu CRON[6069]: (jeremych) CMD (cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log)

crontab -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
* * * * * cd ~/ee4-FYP/software/peer; python3 manage.py runcrons >> ~/cron.log

django_cron code

class Keep_Alive(CronJobBase):
    RUN_EVERY_MINS = 1
    schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
    code = 'peer.keep_alive'

    def do(self):
        <my code, POST request to /keep_alive/>
@Morvarid
Copy link

I'm experiencing the same issue.

@FrankMeyer
Copy link

Maybe it is caused by previous other CronJobBase classes still running.
The actual command is not calling the different CronJobBase classes in parallel.
They are executed iteratively.
See PR #88
Maybe that helps

@JedrzejMaluszczak
Copy link
Contributor

Use manage.py cronloop -s where s is sleep interval in seconds. 300s by default

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

4 participants