簡體   English   中英

如何在ubuntu服務器上守護django celery定期任務?

[英]How to daemonize django celery periodic task on ubuntu server?

在本地主機上,我使用這些語句執行任務和工作程序。 運行任務: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時,它以Unrecogonized命令行參數給出錯誤。 我發出“ celeryd-multi start nodeN”作為命令,並說nodeN已啟動。 但是任務執行尚未開始。

我是守護程序和服務器托管的新手。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM