mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-05-05 07:56:02 -04:00
Systemd service support and documentation update
This commit is contained in:
parent
8be1acee0a
commit
9e9606b8cf
7 changed files with 288 additions and 7 deletions
17
RNS/Utilities/rnsd.py
Normal file → Executable file
17
RNS/Utilities/rnsd.py
Normal file → Executable file
|
@ -2,15 +2,23 @@
|
|||
|
||||
import RNS
|
||||
import argparse
|
||||
import time
|
||||
|
||||
from RNS._version import __version__
|
||||
|
||||
|
||||
def program_setup(configdir, verbosity = 0, quietness = 0):
|
||||
reticulum = RNS.Reticulum(configdir = configdir, loglevel = 3+verbosity-quietness)
|
||||
def program_setup(configdir, verbosity = 0, quietness = 0, service = False):
|
||||
targetloglevel = 3+verbosity-quietness
|
||||
|
||||
if service:
|
||||
RNS.logdest = RNS.LOG_FILE
|
||||
RNS.logfile = RNS.Reticulum.configdir+"/logfile"
|
||||
targetloglevel = None
|
||||
|
||||
reticulum = RNS.Reticulum(configdir=configdir, loglevel=targetloglevel)
|
||||
RNS.log("Started rnsd version {version}".format(version=__version__), RNS.LOG_NOTICE)
|
||||
while True:
|
||||
input()
|
||||
time.sleep(1)
|
||||
|
||||
def main():
|
||||
try:
|
||||
|
@ -18,6 +26,7 @@ def main():
|
|||
parser.add_argument("--config", action="store", default=None, help="path to alternative Reticulum config directory", type=str)
|
||||
parser.add_argument('-v', '--verbose', action='count', default=0)
|
||||
parser.add_argument('-q', '--quiet', action='count', default=0)
|
||||
parser.add_argument('-s', '--service', action='store_true', default=False, help="rnsd is running as a service and should log to file")
|
||||
parser.add_argument("--version", action="version", version="rnsd {version}".format(version=__version__))
|
||||
|
||||
args = parser.parse_args()
|
||||
|
@ -27,7 +36,7 @@ def main():
|
|||
else:
|
||||
configarg = None
|
||||
|
||||
program_setup(configdir = configarg, verbosity=args.verbose, quietness=args.quiet)
|
||||
program_setup(configdir = configarg, verbosity=args.verbose, quietness=args.quiet, service=args.service)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue