@@ -58,17 +58,21 @@ def daemonize(self):
58
58
# redirect standard file descriptors
59
59
sys .stdout .flush ()
60
60
sys .stderr .flush ()
61
- si = file (self .stdin , 'r' )
62
- so = file (self .stdout , 'a+' )
63
- se = file (self .stderr , 'a+' , 0 )
61
+ #si = file(self.stdin, 'r')
62
+ #so = file(self.stdout, 'a+')
63
+ #se = file(self.stderr, 'a+', 0)
64
+ si = open (self .stdin , 'r' )
65
+ so = open (self .stdout , 'a+' )
66
+ se = open (self .stderr , 'a+' )
64
67
os .dup2 (si .fileno (), sys .stdin .fileno ())
65
68
os .dup2 (so .fileno (), sys .stdout .fileno ())
66
69
os .dup2 (se .fileno (), sys .stderr .fileno ())
67
70
68
71
# write pidfile
69
72
atexit .register (self .delpid )
70
73
pid = str (os .getpid ())
71
- file (self .pidfile , 'w+' ).write ("%s\n " % pid )
74
+ #file(self.pidfile, 'w+').write("%s\n" % pid)
75
+ open (self .pidfile , 'w+' ).write ("%s\n " % pid )
72
76
73
77
def delpid (self ):
74
78
os .remove (self .pidfile )
@@ -101,7 +105,8 @@ def stop(self):
101
105
"""
102
106
# Get the pid from the pidfile
103
107
try :
104
- pf = file (self .pidfile , 'r' )
108
+ #pf = file(self.pidfile, 'r')
109
+ pf = open (self .pidfile , 'r' )
105
110
pid = int (pf .read ().strip ())
106
111
pf .close ()
107
112
except IOError :
@@ -135,7 +140,8 @@ def restart(self):
135
140
136
141
def status (self ):
137
142
try :
138
- pf = file (self .pidfile , 'r' )
143
+ #pf = file(self.pidfile, 'r')
144
+ pf = open (self .pidfile , 'r' )
139
145
pid = int (pf .read ().strip ())
140
146
pf .close ()
141
147
except IOError :
0 commit comments