Skip to content

Commit

Permalink
chg: [website] screen for misp-module
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCruciani committed Feb 27, 2024
1 parent 2b94f73 commit 3372ee5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions website/app.py
Expand Up @@ -4,6 +4,18 @@
import os
from app.utils.init_modules import create_modules_db

import signal
import sys
import subprocess

def signal_handler(sig, frame):
path = os.path.join(os.getcwd(), "launch.sh")
req = [path, "-ks"]
subprocess.call(req)
sys.exit(0)

signal.signal(signal.SIGINT, signal_handler)


parser = argparse.ArgumentParser()
parser.add_argument("-i", "--init_db", help="Initialise the db if it not exist", action="store_true")
Expand Down
12 changes: 12 additions & 0 deletions website/launch.sh
@@ -1,8 +1,18 @@
#!/bin/bash
isscripted=`screen -ls | egrep '[0-9]+.misp_mod' | cut -d. -f1`

function killscript {
if [ $isscripted ]; then
screen -X -S misp_mod quit
fi
}

function launch {
export FLASKENV="development"
killscript
screen -dmS "misp_mod"
screen -S "misp_mod" -X screen -t "misp_modules_server" bash -c "../env/bin/misp-modules -l 127.0.0.1; read x"
sleep 2
python3 app.py -m
python3 app.py
}
Expand Down Expand Up @@ -30,6 +40,8 @@ if [ "$1" ]; then
-r | --reload_db ) reload_db;
;;
-t | --test ) test;
;;
-ks | --killscript ) killscript;
esac
shift
else
Expand Down

0 comments on commit 3372ee5

Please sign in to comment.