Browse Source

Adds C_FAKEFORK envvar for simple init script/multi debugging

This means that you can now do:

    C_FAKEFORK=1 celery multi start 10

or

    C_FAKEFORK=1 /etc/init.d/celeryd start

to avoid the daemonization step to see errors that are not visible
due to missing stdout/stderr.
Ask Solem 11 years ago
parent
commit
c93c5bdc5e
1 changed files with 3 additions and 0 deletions
  1. 3 0
      celery/bin/celeryd_detach.py

+ 3 - 0
celery/bin/celeryd_detach.py

@@ -27,6 +27,8 @@ __all__ = ['detached_celeryd', 'detach']
 
 logger = get_logger(__name__)
 
+C_FAKEFORK = os.environ.get('C_FAKEFORK')
+
 OPTION_LIST = daemon_options(default_pidfile='celeryd.pid') + (
     Option('--fake',
            default=False, action='store_true', dest='fake',
@@ -36,6 +38,7 @@ OPTION_LIST = daemon_options(default_pidfile='celeryd.pid') + (
 
 def detach(path, argv, logfile=None, pidfile=None, uid=None,
            gid=None, umask=0, working_directory=None, fake=False, app=None):
+    fake = 1 if C_FAKEFORK else fake
     with detached(logfile, pidfile, uid, gid, umask, working_directory, fake):
         try:
             os.execv(path, [path] + argv)