My celerybeat.conf
[program:celerybeat]
command=/path/app/env/bin/celery beat -A project.tasks --loglevel=INFO
environment=PYTHONPATH=/path/app/env/bin
user=nobody
numprocs=1
stdout_logfile=/var/log/celeryd.log
stderr_logfile=/var/log/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
killasgroup=true
priority=998
When I starting supervisor I receive an error:
pidfile_fd = os.open(self.path, PIDFILE_FLAGS, PIDFILE_MODE)
celery.platforms.LockFailed: [Errno 13] Permission denied: '/celerybeat.pid'
Any idea how to solve this?
The problem is that you have not specified any directory in the config file and the default directory then is '/' (root) which your user does not have permissions to write.
Setting the user as root solved your problem because now you had permission to write to '/' however it might not be the best solution. There are multiple ways you can solve this by including:
Add a directory variable in the config and provide a path that your user has permissions to write to.
directory=<path>
Provide a pidfile argument to the celery command that you are using to start celery. Make sure you have write permissions to the path you specify for the pidfile.
command=/path/app/env/bin/celery beat -A project.tasks --loglevel=INFO --pidfile=/tmp/celerybeat-myapp.pid
Here is my (working) version for Celere beat:
[program:celery_periodic]
command=<venv_path>/bin/python <path>/manage.py celery worker --loglevel=info -c 1 -E -B -Q celery_periodic -f <log_folder>/celery_periodic.log -n periodic_worker
directory=<path>
user=<some_user>
group=<some_user>
autostart=true
autorestart=true
redirect_stderr=True
daemon = False
debug = False
stdout_logfile = NONE
stderr_logfile = NONE
loglevel = "info"
May be this helps.
Also check permissions on folder where you create pid file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With