Initial commit of bin/nntp-tiny-server frontend
This commit is contained in:
parent
58b2b5c1da
commit
7865e1688d
1 changed files with 25 additions and 0 deletions
25
bin/nntp-tiny-server
Executable file
25
bin/nntp-tiny-server
Executable file
|
@ -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()
|
Loading…
Add table
Reference in a new issue