I have custom commend:
python manage.py checksomething
How to run this every two hours?
I saw django-cron:
#example from doc
from django_cron import cronScheduler, Job
from MyMailFunctions import check_feedback_mailbox
class CheckMail(Job):
# run every 300 seconds (5 minutes)
run_every = 300
def job(self):
# This will be executed every 5 minutes
check_feedback_mailbox()
cronScheduler.register(CheckMail)
but how to run it? It will turn on automatically? Do I have something set up on the server? Where should be this file? (In what folder?)
Use crontab, its very simple to use
To edit your crontab:
$ crontab -e
and add your job:
* */2 * * * python /path/to/project/manage.py checksomething