Public » MiniRedis Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

support SIGHUP to rotate logs

Changeset 8c1a60012225

Parent 44a5fe767209

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at 8c1a60012225 Showing diff from parent 44a5fe767209 Diff from another changeset...

Change 1 of 2 Show Entire File miniredis.py Stacked
 
115
116
117
 
 
 
 
118
119
120
 
286
287
288
 
 
289
 
290
291
292
 
115
116
117
118
119
120
121
122
123
124
 
290
291
292
293
294
295
296
297
298
299
@@ -115,6 +115,10 @@
  command = args[0].lower()   self.dump(client, getattr(self, 'handle_' + command)(client, *args[1:]))   + def rotate(self): + self.log_file.close() + self.log_file = open(self.log_name, 'w') +   def run(self):   self.halt = False   server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -286,7 +290,10 @@
 def main(args):   def sigterm(signum, frame):   m.stop() + def sighup(signum, frame): + m.rotate()   signal.signal(signal.SIGTERM, sigterm) + signal.signal(signal.SIGHUP, sighup)     host, port, log_file, db_file = '127.0.0.1', 6379, None, None   opts, args = getopt.getopt(args, 'h:p:d:l:')