我试图让芹菜作为服务运行,我遇到了CELERYBEAT_OPTS参数的问题。我可以很好地启动芹菜服务,我可以通过命令行启动celerybeat,如下所示:
celery -A base beat -S djcelery.schedulers.DatabaseScheduler -l debug --pidfile=/tmp/celerybeat.pid
但是当我开始这样的celerybeat服务时:
sudo service celerybeat start
它没有开始。
这是我在/ etc / default / celerybeat的celerybeat配置文件:
export DJANGO_SETTINGS_MODULE="settings"
# Absolute or relative path to the 'celery' command:
CELERY_BIN="/path/to/.virtualenvs/django/bin/celery"
# Where to chdir at start.
CELERYD_CHDIR="/srv/myproj/"
# Extra arguments to celerybeat
# When the below line is commented out, the service starts!?!
CELERYBEAT_OPTS="-S djcelery.schedulers.DatabaseScheduler"
CELERYBEAT_LOG_FILE="/var/log/celery/beat.log"
CELERYBEAT_PID_FILE="/var/run/celery/beat.pid"
# Workers should run as an unprivileged user.
# You need to create this user manually (or you can choose
# a user/group combination that already exists, e.g. nobody).
CELERYBEAT_USER="myuser"
CELERYBEAT_GROUP="mygroup"
最奇怪的部分是,如配置文件中所述,如果我注释掉CELERYBEAT_OPTS行,我可以使用service命令启动服务。因此,当我指定CELERYBEAT_OPTS =" -S djcelery.schedulers.DatabaseScheduler"时,某些事情导致服务无法启动。在配置文件中。有没有人知道这里发生了什么,或者我怎么能解决它?谢谢。
答案 0 :(得分:0)
我将此行添加到/ etc / default / celerybeat文件中,它开始工作:
CELERY_APP="base"