From 7447bda4ac45745b161b52e2b7c62fe62e9668ba Mon Sep 17 00:00:00 2001 From: airkeyp Date: Thu, 26 Sep 2019 10:20:25 +0200 Subject: [PATCH] chg: [launcher] Adding install and launcher scripts --- .gitignore | 4 +++- analyzer_launch.sh | 22 ++++++++++++++++++++++ bin/export.py | 4 ++++ etc/redis.conf | 2 +- install.sh | 12 ++++++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) create mode 100755 analyzer_launch.sh create mode 100755 install.sh diff --git a/.gitignore b/.gitignore index b336dd0..0b87200 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea/ -ipa.egg-info/ \ No newline at end of file +ipa.egg-info/ +.venv +db/ \ No newline at end of file diff --git a/analyzer_launch.sh b/analyzer_launch.sh new file mode 100755 index 0000000..f000b96 --- /dev/null +++ b/analyzer_launch.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +if [ -e "${DIR}/.venv/bin/python" ]; then + ENV_PY="${DIR}/.venv/bin/python" +else + echo "Please make sure you ran install.sh first." + exit 1 +fi + +if [ ! -d "${DIR}/db" ]; then + mkdir db +fi + +screen -dmS "ipa" +sleep 0.1 + +screen -S "ipa" -X screen -t "ipa-redis" bash -c "(redis-server ${DIR}/etc/redis.conf); read x;" +screen -S "ipa" -X screen -t "ipa-d4" bash -c "(cd bin; ${ENV_PY} ./run_ipa.py; read x;)" + +exit 0 \ No newline at end of file diff --git a/bin/export.py b/bin/export.py index 00b7924..b3fbb35 100644 --- a/bin/export.py +++ b/bin/export.py @@ -35,3 +35,7 @@ def export_icmp_types(): for key in redis_dict: res += mds.table_row([key.decode(), redis_dict[key].decode()], [10, 10]) + '\n' return res + + +if __name__ == "__main__": + export_icmp_types() diff --git a/etc/redis.conf b/etc/redis.conf index 544a8c1..2d7a22d 100644 --- a/etc/redis.conf +++ b/etc/redis.conf @@ -260,7 +260,7 @@ dbfilename dump.rdb # The Append Only File will also be created inside this directory. # # Note that you must specify a directory here, not a file name. -dir ../db +dir ./db ################################# REPLICATION ################################# diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..e1df4aa --- /dev/null +++ b/install.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e +set -x + +export PIPENV_VENV_IN_PROJECT=1 + +if [ -z "$VIRTUAL_ENV" ]; then + pipenv install + export IPA_HOME=$(pwd) +fi +