some helps. separate port for tcp
This commit is contained in:
@@ -11,3 +11,9 @@ You can send a custom text file with the update, generated with ex. `nando-desc`
|
||||
Nando clients can query which other clients are online, and what their status is
|
||||
(whatever you choose to update with the text data)
|
||||
|
||||
|
||||
## Installer
|
||||
|
||||
as root, with your own risk:
|
||||
|
||||
curl https://bitbucket.org/MoonQ/nando/raw/tip/update.sh | bash -
|
||||
|
||||
22
nandod
22
nandod
@@ -13,13 +13,15 @@ def setup_options():
|
||||
|
||||
parser=ArgumentParser(description="Alive notifier.")
|
||||
parser.add_argument("--host",action='store', dest='HOST',default='0.0.0.0',type=str,
|
||||
help="Bind to address")
|
||||
help="Bind to address: %(default)s")
|
||||
parser.add_argument("--port", action='store', dest='PORT', default=13370,type=int,
|
||||
help="Bind to port")
|
||||
help="Bind to port: %(default)s")
|
||||
parser.add_argument("--html-port", action='store', dest='WEBPORT', default=13370,type=int,
|
||||
help="Bind www server to port. 0 to disable, default: %(default)s")
|
||||
parser.add_argument("--db",action='store', dest='DB',default='/tmp/nando.sqlite',type=str,
|
||||
help="Sqlite file for database.")
|
||||
help="Sqlite file for database: %(default)s")
|
||||
parser.add_argument("--quiet","-q",action='store_true', dest='quiet',default=False,
|
||||
help="Quiet operation.")
|
||||
help="Quiet operation: %(default)s")
|
||||
options=parser.parse_args()
|
||||
return options
|
||||
|
||||
@@ -192,12 +194,17 @@ def humanize_time(secs):
|
||||
if __name__ == "__main__":
|
||||
opts=setup_options()
|
||||
if not opts.quiet:
|
||||
print("Starting NandoD {0}:{1}".format(opts.HOST,opts.PORT))
|
||||
print("Starting NandoD UDP:{0}:{1}, TCP:{0}:{2}".format(
|
||||
opts.HOST,
|
||||
opts.PORT,
|
||||
opts.WEBPORT
|
||||
))
|
||||
UDP=threading.Thread(target=UDPserve)
|
||||
TCP=threading.Thread(target=TCPserve)
|
||||
UDP.daemon=True
|
||||
TCP.daemon=True
|
||||
UDP.start()
|
||||
if options.WEBPORT > 0:
|
||||
TCP=threading.Thread(target=TCPserve)
|
||||
TCP.daemon=True
|
||||
TCP.start()
|
||||
while True:
|
||||
try:
|
||||
@@ -205,5 +212,6 @@ if __name__ == "__main__":
|
||||
except KeyboardInterrupt:
|
||||
print("Exiting..")
|
||||
server.shutdown()
|
||||
if options.WEBPORT > 0:
|
||||
HTMLserver.shutdown()
|
||||
sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user