Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed bug in worker, service deamon restart

  • Loading branch information...
commit 36af1a5c4d84264426a8355c2880e110e892bfe7 1 parent 1e4bc05
@JeremyOT authored
Showing with 4 additions and 2 deletions.
  1. +2 −1  toto/service.py
  2. +2 −1  toto/worker.py
View
3  toto/service.py
@@ -81,9 +81,9 @@ def run(self):
pattern = pid_path_with_id(options.pidfile, r'\d+').replace('.', r'\.')
piddir = os.path.dirname(pattern)
- existing_pidfiles = [pidfile for pidfile in (os.path.join(piddir, fn) for fn in os.listdir(os.path.dirname(pattern))) if re.match(pattern, pidfile)]
if options.daemon == 'stop' or options.daemon == 'restart':
+ existing_pidfiles = [pidfile for pidfile in (os.path.join(piddir, fn) for fn in os.listdir(os.path.dirname(pattern))) if re.match(pattern, pidfile)]
for pidfile in existing_pidfiles:
with open(pidfile, 'r') as f:
pid = int(f.read())
@@ -96,6 +96,7 @@ def run(self):
os.remove(pidfile)
if options.daemon == 'start' or options.daemon == 'restart':
+ existing_pidfiles = [pidfile for pidfile in (os.path.join(piddir, fn) for fn in os.listdir(os.path.dirname(pattern))) if re.match(pattern, pidfile)]
if existing_pidfiles:
print "Not starting %s, pidfile%s exist%s at %s" % (self.__class__.__name__, len(existing_pidfiles) > 1 and 's' or '', len(existing_pidfiles) == 1 and 's' or '', ', '.join(existing_pidfiles))
return
View
3  toto/worker.py
@@ -181,9 +181,9 @@ def run(self):
pattern = pid_path_with_id(options.pidfile, r'\d+').replace('.', r'\.')
piddir = os.path.dirname(pattern)
- existing_pidfiles = [pidfile for pidfile in (os.path.join(piddir, fn) for fn in os.listdir(os.path.dirname(pattern))) if re.match(pattern, pidfile)]
if options.daemon == 'stop' or options.daemon == 'restart':
+ existing_pidfiles = [pidfile for pidfile in (os.path.join(piddir, fn) for fn in os.listdir(os.path.dirname(pattern))) if re.match(pattern, pidfile)]
for pidfile in existing_pidfiles:
with open(pidfile, 'r') as f:
pid = int(f.read())
@@ -197,6 +197,7 @@ def run(self):
if options.daemon == 'start' or options.daemon == 'restart':
import sys
+ existing_pidfiles = [pidfile for pidfile in (os.path.join(piddir, fn) for fn in os.listdir(os.path.dirname(pattern))) if re.match(pattern, pidfile)]
if existing_pidfiles:
print "Not starting, pidfile%s exist%s at %s" % (len(existing_pidfiles) > 1 and 's' or '', len(existing_pidfiles) == 1 and 's' or '', ', '.join(existing_pidfiles))
return
Please sign in to comment.
Something went wrong with that request. Please try again.