Lot of refactoring in the daemon class and some more cleanups.

This commit is contained in:
Johannes Findeisen 2022-08-25 19:48:05 +02:00
commit d815508396
4 changed files with 63 additions and 43 deletions

12
uplink
View file

@ -31,13 +31,17 @@ import time
from uplink import Uplink
# Version format: MAJOR.FEATURE.FIXES
__version__ = "0.6.0"
__version__ = "0.6.1"
# TODO: CHECK ALL ERROR HANDLING!!!
# TODO: IDEA: Implement a small webserver inline to get statistics and graphs over the network?
# Or maybe better as a separate daemon
# Or maybe better as a separate daemon?
# TODO: Make use of more args passed to the script
# TODO: Implement a speedtest that will also run regularly but in an individual interval
# TODO: become more verbose in each log level and log only to error when it really is an error
# else log to info
# TODO: Maybe make path to pid_file an arg to use /var/run/$user/uplink.pid instead of
# /tmp/uplink.pid
logger = logging.getLogger(__name__)
@ -139,7 +143,7 @@ def main():
config_data = configfile.read()
config = json.loads(config_data)
except Exception as err:
logger.error(str("uplink: configuration error!\n" + str(err)))
logger.error(str("uplink: configuration error! {0}".format(err)))
sys.exit(1)
try:
@ -175,7 +179,7 @@ def main():
t.start()
try:
time.sleep(config["interval"])
except KeyboardInterrupt as err:
except KeyboardInterrupt:
logger.info(str("uplink: program terminated by user!"))
sys.exit(0)
else: