Django crontab定时任务模块操作方法解析

Thalia ·
更新时间:2024-09-20
· 638 次阅读

Django crontab定时任务

安装

pip install django-crontab

配置

在settings.py中 INSTALLED_APP中添加'django_crontab'

CRONJOBS = [ ('*/1 * * * *','echo "hello world" > /dev/null') ]

应用

函数

def demo(): 你所要执行的业务逻辑 CRONJOBS = [ ('*/1 * * * *','demo函数路径" ') ]

查看已有的定时任务

python manage.py crontab show

添加定时任务

python manage.py crontab add

删除 python manage.py crontab remove 运行 python manage.py crontab run

从服务器确认定时任务是否已经添加

crontab -l
crontab -e

您可能感兴趣的文章:django-crontab实现服务端的定时任务的示例代码详解Linux下crontab的使用与注意事项linux 上在指定时间段内每隔多少分钟自动执行任务计划crontabcentOS6中使用crontab定时运行执行jar程序的脚本laravel 解决crontab不执行的问题crontab执行结果未通过发送mail通知用户的方法



模块 方法 crontab Django

需要 登录 后方可回复, 如果你还没有账号请 注册新账号