backup script and minor config changes

This commit is contained in:
mt 2022-10-24 10:59:19 +02:00
parent 34b7a1c280
commit 75e0100144
4 changed files with 41 additions and 3 deletions

4
.gitignore vendored
View file

@ -5,6 +5,8 @@ node_modules
.project
config.local.yml
hit_store.db
backup/*
www/scans/*.svg
#scanimation/interfa
GeoLite2-Country.mmdb

36
backup_and_reset.sh Executable file
View file

@ -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."

View file

@ -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

View file

@ -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):