diff --git a/README.md b/README.md index e3c0266..90c3805 100644 --- a/README.md +++ b/README.md @@ -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 - diff --git a/nandod b/nandod index b9c9312..6cab4ad 100755 --- a/nandod +++ b/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,18 +194,24 @@ 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() - TCP.start() + if options.WEBPORT > 0: + TCP=threading.Thread(target=TCPserve) + TCP.daemon=True + TCP.start() while True: try: time.sleep(1) except KeyboardInterrupt: print("Exiting..") server.shutdown() - HTMLserver.shutdown() + if options.WEBPORT > 0: + HTMLserver.shutdown() sys.exit(0)