【问题标题】:How to daemonize django celery periodic task on ubuntu server?如何在 ubuntu 服务器上守护 django celery 定期任务?
【发布时间】:2013-10-09 19:27:55
【问题描述】:

在本地主机上,我使用这些语句来执行任务和工作人员。 运行任务: python manage.py celery beat 运行工人: python manage.py celery worker --loglevel=info 我使用了 otp、rabbitmq 服务器和 django-celery。 它工作正常。 我在ubuntu服务器上上传了项目。我想守护这些。 为此,我创建了一个文件 /etc/default/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="/home/sandbox/myprojrepo/myproj"

# 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"

celery 配置模块的名称。

CELERY_CONFIG_MODULE="celeryconfig"

# %n will be replaced with the nodename.
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"

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

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

我还用我下载的脚本创建了一个文件 /etc/init.d/celeryd。

现在,当我尝试执行 /etc/init.d/celeryd start 时,它会给出错误作为无法识别的命令行参数。 我发出“celeryd-multi start nodeN”作为命令,它说 nodeN 已启动。但是任务执行还没有开始。

我是守护进程和服务器托管的新手。

【问题讨论】:

    标签: python django celery django-celery


    【解决方案1】:
    猜你喜欢
    • 2016-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-15
    • 2014-02-23
    • 2016-05-05
    • 2017-01-06
    • 2017-10-22
    相关资源
    最近更新 更多