xenu_nntp/bin/nntp-tiny-server

26 lines
496 B
Text
Raw Normal View History

#! /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()