Commit e025bfd0 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

equeue: fix restart problem by removing socket

parent 72ae7f9c
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
import argparse import argparse
import errno
import gdbm import gdbm
import json import json
import logging import logging
...@@ -143,10 +144,16 @@ def main(): ...@@ -143,10 +144,16 @@ def main():
signal.signal(signal.SIGHUP, lambda *args: sys.exit(-1)) signal.signal(signal.SIGHUP, lambda *args: sys.exit(-1))
signal.signal(signal.SIGTERM, lambda *args: sys.exit()) signal.signal(signal.SIGTERM, lambda *args: sys.exit())
try:
server = EqueueServer(socketpath, **{'equeue_options':args}) server = EqueueServer(socketpath, **{'equeue_options':args})
server.logger.info("Starting server on %r", socketpath) server.logger.info("Starting server on %r", socketpath)
server.serve_forever() server.serve_forever()
finally:
try:
os.remove(socketpath)
except OSError, e:
if e.errno != errno.ENOENT:
raise
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment