Python Celery init.d脚本OSError:[Errno 1]不允许操作

时间:2014-05-28 20:26:38

标签: python django celery django-celery

启动/etc/init.d/celeryd时,我收到以下错误消息。我确保所有目录都是可读的,并且我正在启动它。我甚至做了touch文件,以确保在所有地方都有一个文件要写入的指令。

(community)community@community:~$ /etc/init.d/celeryd  start
bot_server.settings.production
celery multi v3.1.11 (Cipater)
> Starting nodes...
    > w1.bot_server@community.net: Traceback (most recent call last):
  File "/home/community/community-forums/bot_server/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/djcelery/management/commands/celeryd_detach.py", line 26, in run_from_argv
    detached().execute_from_commandline(argv)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/bin/celeryd_detach.py", line 160, in execute_from_commandline
    **vars(options)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/bin/celeryd_detach.py", line 42, in detach
    with detached(logfile, pidfile, uid, gid, umask, working_directory, fake):
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/platforms.py", line 383, in detached
    maybe_drop_privileges(uid=uid, gid=gid)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/platforms.py", line 520, in maybe_drop_privileges
    initgroups(uid, gid)
  File "/home/community/.virtualenvs/community/local/lib/python2.7/site-packages/celery/platforms.py", line 473, in initgroups
    return os.initgroups(username, gid)
OSError: [Errno 1] Operation not permitted
* Child terminated with errorcode 1
FAILED

我正在使用:

Django==1.6.3
celery==3.1.11
celerymon==1.0.3
django-celery==3.1.10
django-celery-with-redis==3.0

1 个答案:

答案 0 :(得分:2)

OSError errno 1看起来像权限问题: OSError: [Error 1] Operation not permitted

看起来问题出在os.initgroups上,它调用系统上的initgroups - 见man initgroups

在您的提示中,您似乎正在使用某种角色帐户,我猜您的角色/群组权限与django正在访问的文件的设置方式存在一些问题。

修改 来自man initgroups

DESCRIPTION
   The initgroups() function initializes the group access list by reading
   the group database /etc/group and using all groups of which user is a member.
   The additional group group is also added to the list.

可以community读取/ etc / group吗?