Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
-
From 5b9341940774f1c168f550f0af6c576bb64b2731 Mon Sep 17 00:00:00 2001
From: Josh <josh@glencoesoftware.com>
Date: Wed, 3 Nov 2010 11:49:37 +0100
Subject: [PATCH] Possible fix for double bin/omero web start invocations (See #3216)
---
components/tools/OmeroPy/src/omero/plugins/web.py | 48 ++++++++++++++++-----
1 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/components/tools/OmeroPy/src/omero/plugins/web.py b/components/tools/OmeroPy/src/omero/plugins/web.py
index 70de352..1d7f3c0 100755
a
|
b
|
Alias / "%(ROOT)s/var/omero.fcgi/" |
261 | 261 | getattr(settings, 'CACHE_BACKEND')) |
262 | 262 | return 1 |
263 | 263 | deploy = getattr(settings, 'APPLICATION_SERVER') |
| 264 | |
| 265 | # 3216 |
| 266 | if deploy in (settings.FASTCGI_TYPES): |
| 267 | pid_path = self.ctx.dir / "var" / "django.pid" |
| 268 | pid_num = None |
| 269 | |
| 270 | if pid_path.exists(): |
| 271 | pid_txt = pid_path.text().strip() |
| 272 | try: |
| 273 | pid_num = int(pid_txt) |
| 274 | except: |
| 275 | pid_path.remove() |
| 276 | self.ctx.err("Removed invalid %s: '%s'" % (pid_path, pid_txt)) |
| 277 | |
| 278 | if pid_num is not None: |
| 279 | try: |
| 280 | os.kill(pid_num, 0) |
| 281 | self.ctx.die(606, "%s exists! Use 'web stop' first" % pid_path) |
| 282 | except OSError: |
| 283 | pid_path.remove() |
| 284 | self.ctx.err("Removed stale %s" % pid_path) |
| 285 | |
264 | 286 | if deploy == settings.FASTCGI: |
265 | 287 | cmd = "python manage.py runfcgi workdir=./" |
266 | 288 | cmd += " method=prefork socket=%(base)s/var/django_fcgi.sock" |
… |
… |
Alias / "%(ROOT)s/var/omero.fcgi/" |
319 | 341 | deploy = getattr(settings, 'APPLICATION_SERVER') |
320 | 342 | if deploy in settings.FASTCGI_TYPES: |
321 | 343 | pid = 'Unknown' |
| 344 | pid_path = self.ctx.dir / "var" / "django.pid" |
| 345 | pid_text = pid_path.text().strip() |
322 | 346 | try: |
323 | | f=open(self.ctx.dir / "var" / "django.pid", 'r') |
324 | | pid = int(f.read()) |
325 | | import signal |
326 | | os.kill(pid, 0) # NULL signal |
327 | | except: |
328 | | self.ctx.out("[FAILED]") |
329 | | self.ctx.out("Django FastCGI workers (PID %s) not started?" % pid) |
330 | | return |
331 | | os.kill(pid, signal.SIGTERM) #kill whole group |
332 | | self.ctx.out("[OK]") |
333 | | self.ctx.out("Django FastCGI workers (PID %d) killed." % pid) |
| 347 | try: |
| 348 | pid = int(pid_text) |
| 349 | import signal |
| 350 | os.kill(pid, 0) # NULL signal |
| 351 | except: |
| 352 | self.ctx.out("[FAILED]") |
| 353 | self.ctx.out("Django FastCGI workers (PID %s) not started?" % pid_text) |
| 354 | return |
| 355 | os.kill(pid, signal.SIGTERM) #kill whole group |
| 356 | self.ctx.out("[OK]") |
| 357 | self.ctx.out("Django FastCGI workers (PID %d) killed." % pid) |
| 358 | finally: |
| 359 | pid_path.remove() |
334 | 360 | else: |
335 | 361 | self.ctx.err("DEVELOPMENT: You will have to kill processes by hand!") |
336 | 362 | |
Download in other formats:
1.3.13-PRO © 2008-2011
Agilo Software all
rights reserved
(this page was served in: 0.7933 sec.)