Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
.. image:: https://img.shields.io/travis/kraiz/django-crontab/master.svg :target: https://travis-ci.org/kraiz/django-crontab .. image:: https://img.shields.io/coveralls/kraiz/django-crontab/master.svg :target: https://coveralls.io/r/kraiz/django-crontab .. image:: https://img.shields.io/pypi/dw/django-crontab.svg :target: https://pypi.python.org/pypi/django-crontab .. image:: https://img.shields.io/pypi/v/django-crontab.svg :target: https://pypi.python.org/pypi/django-crontab .. image:: https://img.shields.io/pypi/pyversions/django-crontab.svg :target: https://pypi.python.org/pypi/django-crontab .. image:: https://img.shields.io/pypi/l/django-crontab.svg :target: https://pypi.python.org/pypi/django-crontab
dead simple crontab powered job scheduling for django (1.8+).
install via pip::
pip install django-crontab
add it to installed apps in django settings.py::
INSTALLED_APPS = (
'django_crontab',
...
)
now create a new method that should be executed by cron every 5 minutes, f.e. in myapp/cron.py
::
def my_scheduled_job():
pass
now add this to your settings.py::
CRONJOBS = [
('*/5 * * * *', 'myapp.cron.my_scheduled_job')
]
you can also define positional and keyword arguments which let you call django management commands::
CRONJOBS = [
('*/5 * * * *', 'myapp.cron.other_scheduled_job', ['arg1', 'arg2'], {'verbose': 0}),
('0 4 * * *', 'django.core.management.call_command', ['clearsessions']),
]
finally run this command to add all defined jobs from CRONJOBS
to crontab (of the user which you are running this command with)::
python manage.py crontab add
show current active jobs of this project::
python manage.py crontab show
removing all defined jobs is straight forward::
python manage.py crontab remove
there are a bunch of setting vars to customize behavior. each of this comes with default values that should properly fit. if not, feel free to overwrite.
CRONJOBS
list of jobs, each defined as tuple:
format 1:
format 2:
NOTE: Run "python manage.py crontab add" each time you change CRONJOBS in any way!
default: []
example::
CRONJOBS = [
('*/5 * * * *', 'myapp.cron.my_scheduled_job'),
# format 1
('0 0 1 * *', 'myapp.cron.my_scheduled_job', '>> /tmp/scheduled_job.log'),
# format 2
('0 0 1 * *', 'myapp.cron.other_scheduled_job', ['myapp']),
('0 0 * * 0', 'django.core.management.call_command', ['dumpdata', 'auth'], {'indent': 4}, '> /home/john/backups/last_sunday_auth_backup.json'),
]
CRONTAB_LOCK_JOBS
CRONTAB_EXECUTABLE
CRONTAB_DJANGO_PROJECT_NAME
CRONTAB_DJANGO_MANAGE_PATH
CRONTAB_DJANGO_SETTINGS_MODULE
CRONTAB_PYTHON_EXECUTABLE
add
the jobs (via 'python manage.py crontab add')CRONTAB_COMMAND_PREFIX
CRONTAB_COMMAND_SUFFIX
CRONTAB_COMMENT
arski cinghiale meric426 justdoit0823 chamaken
I'm using this old django version (<1.8) and can't install this package. What should i do?
Yeah, update django of course (!) or - as you seem to be familiar with old, unsupported versions, install the old version of this package too (it support django 1.3-1.7)::
pip install django-crontab==0.6.0
Will it work with windows?
I'm getting "bad command"/"errors in cronfile" while installing via "crontab add". What's wrong?
CRONJOBS
. (see #23)MIT-License, see LICENSE file.
FAQs
dead simple crontab powered job scheduling for django
We found that django-crontab demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.