我通过以下python脚本启动Celery工人
subprocess.Popen("celery -A test_celery worker -Q {} --loglevel=info -n {} -Ofair ".format(str(ContactID)+'_rec',worker1),shell=True,stdin=None, stdout=open(os.devnull, 'wb'), stderr=open(os.devnull, 'wb'))
当我以sudo用户或服务身份运行此Python脚本时,Celery无法正常工作,但以正常的Ubuntu用户身份运行它会很好。
答案 0 :(得分:0)
可以通过在.service文件的“服务”部分中指定用户来完成