Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudmercato/django-dbcron
Manage your crontab directly from DB
https://github.com/cloudmercato/django-dbcron
cron crontab django scheduler
Last synced: about 1 month ago
JSON representation
Manage your crontab directly from DB
- Host: GitHub
- URL: https://github.com/cloudmercato/django-dbcron
- Owner: cloudmercato
- License: bsd-3-clause
- Created: 2019-02-07T01:33:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-25T03:42:22.000Z (about 1 year ago)
- Last Synced: 2024-11-15T19:25:56.605Z (about 1 month ago)
- Topics: cron, crontab, django, scheduler
- Language: Python
- Size: 32.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
django-dbcron
=============Manage crontab directly from your Django database
Why
---They are plenty of implementation of crontabs in Python and Django, but our
issue was their elasticity. Generally a set of classes will allow you to
create a crontab, here in django-dbcron, things are stored in database
instead of Python classes.Installation
------------Classic pip install: ::
pip install django-dbcron
Add it to you ``INSTALLED_APPS``: ::
INSTALLED_APPS = (
...
'dbcron',
...
)Launch migrations: ::
./manage.py migrate dbcron
Usage
-----This app owns its own cron daemon, launch it with: ::
./manage.py crond
The daemon will act as a classic cron and will run each task in a new thread,
leaving the main one continuing.From admin
~~~~~~~~~The cron table is set in database and the Django admin site is a quick
solution to manage you jobs.From Python
~~~~~~~~~~Just play with the model: ::
from dbcron.models import Job
# Run now() each minute
job = Job.object.create(
name='My job',
func='django.utils.timezone.now',
is_active=True,
sec="0",
min="*/1,
hou="*",
dom="*",
mon="*",
dow="*",
yea="*"
)# Test it
job.run()Warning
-------The cron daemon launches jobs as they are requested with:
- function's path
- arguments and keyword argumentsThere's no security about who/when/how, just functions launched abritairly,
Be careful who can set crontab, and do not hesitate to limit possible values.