From 75e010014471b847c5837cd1cbc40a21e978d2a1 Mon Sep 17 00:00:00 2001 From: mt Date: Mon, 24 Oct 2022 10:59:19 +0200 Subject: [PATCH] backup script and minor config changes --- .gitignore | 4 +++- backup_and_reset.sh | 36 ++++++++++++++++++++++++++++++++++++ sorteerhoed.py | 2 +- sorteerhoed/webserver.py | 2 +- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100755 backup_and_reset.sh diff --git a/.gitignore b/.gitignore index d1b2870..9a5faf5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ node_modules .project config.local.yml hit_store.db - +backup/* www/scans/*.svg #scanimation/interfa +GeoLite2-Country.mmdb + diff --git a/backup_and_reset.sh b/backup_and_reset.sh new file mode 100755 index 0000000..a82a063 --- /dev/null +++ b/backup_and_reset.sh @@ -0,0 +1,36 @@ +#!/bin/bash +BACKUP_DIR="backup/$1" + +if [ -d "$BACKUP_DIR" ]; then + >&2 echo "$BACKUP_DIR already exists. (usage: ./backup_and_reset.sh BACKUP_NAME)" + exit 1 +fi + +read -p "If you continue current config will be copied to '$BACKUP_DIR'. Continue? [y/n]" -r +echo # (optional) move to a new line +if [[ ! $REPLY =~ ^[Yy]$ ]] +then + echo "Cancelling" + exit 1 +fi + +mkdir "$BACKUP_DIR" +cp www/scans "$BACKUP_DIR/" -Rv +cp hit_store.db "$BACKUP_DIR/" +cp scanimation/interfaces/frames "$BACKUP_DIR/" -Rv + + +read -p "Reset or keep original files. WARNING, type yes for reset [y/n]" -r +echo # (optional) move to a new line +if [[ ! $REPLY =~ ^[Yy]$ ]] +then + echo "Exit without resetting." + exit 1 +fi + +# reset +rm hit_store.db +rm scanimation/interfaces/frames/*.jpg +rm www/scans/*.svg + +echo "Done resetting files." diff --git a/sorteerhoed.py b/sorteerhoed.py index 918b57c..9d48d9f 100644 --- a/sorteerhoed.py +++ b/sorteerhoed.py @@ -44,7 +44,7 @@ if __name__ == '__main__': coloredlogs.install( level=loglevel, # default: "%(asctime)s %(hostname)s %(name)s[%(process)d] %(levelname)s %(message)s" - fmt="%(asctime)s %(hostname)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s" + fmt="%(asctime)s %(hostname)s %(name)s[%(process)d,%(threadName)s,%(pathname)s:%(lineno)d] %(levelname)s %(message)s" ) # File logging diff --git a/sorteerhoed/webserver.py b/sorteerhoed/webserver.py index 7739f5a..1fc9b50 100644 --- a/sorteerhoed/webserver.py +++ b/sorteerhoed/webserver.py @@ -235,7 +235,7 @@ class ConfigWebSocketHandler(tornado.websocket.WebSocketHandler): """ Websocket for config & control """ - CORS_ORIGINS = ['localhost', 'guest.rubenvandeven.com'] + CORS_ORIGINS = ['localhost', '192.168.1.102','guest.rubenvandeven.com'] connections = set() def initialize(self, config, plotterQ: Queue, eventQ: Queue, store: HITStore):