[Answered ]-Celery and Django โ€“ Running worker as Daemon (Mac OS X)

2๐Ÿ‘

โœ…

I was struggling with the issue. While I didnโ€™t go the launchd route, I eventually got daemonized workers using the daemonize utility.

http://software.clapper.org/daemonize/

You can easily install it with brew.

Then using Fabric I can restart the workers like so:

def celeryd():
    with cd('/usr/local/Cellar/daemonize/1.7.4/sbin'):
        # Kill existing workers
        sudo('ps auxww | grep celeryd | grep -v "grep" | awk \'{print $2}\' | xargs kill')
        # Create new workers
        sudo('daemonize -u pipeadmin %s/manage.py celery worker' % siteDir)
๐Ÿ‘คChad Vernon

Leave a comment