From 7865e1688de7f4fa7cae73e371686c89745f0014 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 3 Dec 2024 16:07:40 -0500 Subject: [PATCH] Initial commit of bin/nntp-tiny-server frontend --- bin/nntp-tiny-server | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 bin/nntp-tiny-server diff --git a/bin/nntp-tiny-server b/bin/nntp-tiny-server new file mode 100755 index 0000000..784a8eb --- /dev/null +++ b/bin/nntp-tiny-server @@ -0,0 +1,25 @@ +#! /usr/bin/env python3 + +import os +import argparse + +from nntp.tiny.config import Config +from nntp.tiny.db import Database +from nntp.tiny.server import Server + +parser = argparse.ArgumentParser(description='Tiny NNTP server') +parser.add_argument('--daemon', '-d', action='store_true', help='Run NNTP server as daemon in background') + +args = parser.parse_args() + +config = Config.load() + +server = Server(config) + +if args.daemon: + pid = os.fork() + + if pid > 0: + exit(0) + +server.run()