25 lines
648 B
Python
Executable file
25 lines
648 B
Python
Executable file
#! /usr/bin/env python3
|
|
|
|
import os
|
|
import argparse
|
|
|
|
from xenu_nntp.config import Config
|
|
from xenu_nntp.server import Server
|
|
from xenu_nntp.daemon import Daemon
|
|
|
|
parser = argparse.ArgumentParser(description='Tiny NNTP server')
|
|
parser.add_argument('--daemon', '-d', action='store_true', help='Run NNTP server as daemon in background')
|
|
parser.add_argument('--config-file', '-f', type=str, help='Specify a configuration file location')
|
|
|
|
args = parser.parse_args()
|
|
|
|
config = Config.load(args.config_file)
|
|
server = Server(config)
|
|
|
|
if args.daemon:
|
|
Daemon.init(config)
|
|
|
|
try:
|
|
server.run()
|
|
except KeyboardInterrupt:
|
|
server.stop()
|