Skip to content

Commit 2091222

Browse files
committed
Merge pull request #1 from ternstor/master
Fixed args for start() call on restart().
2 parents 2fedd11 + 1126174 commit 2091222

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

initd.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from __future__ import with_statement
88

9-
import logging, os, signal, sys, time
9+
import logging, os, signal, sys, time, errno
1010

1111
__all__ = ['start', 'stop', 'restart', 'execute']
1212

@@ -100,8 +100,14 @@ def stop(self, run=None, exit=None):
100100
signal to the process with that as its pid. This will also wait until
101101
the running process stops running.
102102
"""
103-
with open(self.pid_file, 'r') as stream:
104-
pid = int(stream.read())
103+
try:
104+
with open(self.pid_file, 'r') as stream:
105+
pid = int(stream.read())
106+
except IOError as ioe:
107+
if ioe.errno != errno.ENOENT:
108+
raise
109+
sys.stdout.write('Stopped.\n')
110+
return
105111
sys.stdout.write('Stopping.')
106112
sys.stdout.flush()
107113
os.kill(pid, signal.SIGTERM)
@@ -123,7 +129,7 @@ def restart(self, run, exit=None):
123129
if os.path.exists(self.pid_file):
124130
self.stop(self.pid_file)
125131
print 'Starting.'
126-
self.start(run, self.pid_file, self.log_file)
132+
self.start(run, exit=exit)
127133

128134

129135
def execute(self, action, run=None, exit=None):

0 commit comments

Comments
 (0)