Skip to main content

Manage your crontab directly from DB.

Project description

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 arguments

There'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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-dbcron-0.5.0.tar.gz (12.7 kB view details)

Uploaded Source

File details

Details for the file django-dbcron-0.5.0.tar.gz.

File metadata

  • Download URL: django-dbcron-0.5.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.5.2

File hashes

Hashes for django-dbcron-0.5.0.tar.gz
Algorithm Hash digest
SHA256 bfcf1c4c5ecdd297981b69d2d932fc3198d28a53089b74cf72bb2e5cd91e09c8
MD5 6d84a0e075f490a407b7d6336ee66d83
BLAKE2b-256 9c80c8c17006818b9bcb125a92ae41fed76e58a8f207dc6d29c368836d9cab3f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page