首页 文章

如何在ubuntu服务器上守护django芹菜周期性任务?

提问于
浏览
1

在localhost上,我使用这些语句来执行任务和工作程序 . 运行任务:python manage.py celery beat Run worker:python manage.py celery worker --lvelvel = info我使用了otp,rabbitmq server和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_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启动时,它会将错误视为Unrecogonized命令行参数 . 我发出了“celeryd-multi start nodeN”作为命令,它说nodeN启动了 . 但任务执行还没有开始 .

我是daemonizing和服务器托管的新手 .

1 回答

相关问题