用于节拍模式的Django脚本配置

时间:2013-05-29 10:32:30

标签: django celery django-celery

以下是我目前的/etc/init.d/celeryd脚本:

# Name of nodes to start, here we have a single node
#CELERYD_NODES="w1"
# or we could have three nodes:
CELERYD_NODES="w1 w2 w3"

# Where to chdir at start.
CELERYD_CHDIR="/srv/project/website"

# How to call "manage.py celeryd_multi"
CELERYD_MULTI="$CELERYD_CHDIR/manage.py celeryd_multi"

# How to call "manage.py celeryctl"
CELERYCTL="$CELERYD_CHDIR/manage.py celeryctl"

# Extra arguments to celeryd
CELERYD_OPTS="--time-limit=300 --concurrency=8"

# %n will be replaced with the nodename.
CELERYD_LOG_FILE="/srv/project/logs/celery/%n.log"
CELERYD_PID_FILE="/srv/project/celery/%n.pid"

# Workers should run as an unprivileged user.
CELERYD_USER="root"
CELERYD_GROUP="root"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="website.settings"

我现在想要运行定期任务,添加/更改上面的示例如何为节拍模式创建脚本配置?

我只是将以下内容添加到文件中吗?什么是最后一行?

# Where the Django project is.
CELERYBEAT_CHDIR="/srv/project/website"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="website.settings"

# Path to celerybeat
CELERYBEAT="/opt/project/website/manage.py celerybeat"

# Extra arguments to celerybeat
CELERYBEAT_OPTS="--schedule=/var/run/celerybeat-schedule"

1 个答案:

答案 0 :(得分:1)

是的,您可以将其添加到脚本底部或创建一个init脚本指向的新脚本。