misp-modules/website/launch.sh

50 lines
1.0 KiB
Bash
Raw Normal View History

2024-02-07 14:39:19 +01:00
#!/bin/bash
2024-02-27 11:21:49 +01:00
isscripted=`screen -ls | egrep '[0-9]+.misp_mod' | cut -d. -f1`
2024-02-07 14:39:19 +01:00
2024-02-27 11:21:49 +01:00
function killscript {
if [ $isscripted ]; then
screen -X -S misp_mod quit
fi
}
2024-02-07 14:39:19 +01:00
function launch {
export FLASKENV="development"
2024-02-27 11:21:49 +01:00
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
2024-02-07 14:39:19 +01:00
python3 app.py -m
python3 app.py
}
function test {
export FLASKENV="testing"
pytest
}
function init_db {
python3 app.py -i
}
function reload_db {
python3 app.py -r
}
if [ "$1" ]; then
case $1 in
-l | --launch ) launch;
;;
-i | --init_db ) init_db;
;;
-r | --reload_db ) reload_db;
;;
-t | --test ) test;
2024-02-27 11:21:49 +01:00
;;
-ks | --killscript ) killscript;
2024-02-07 14:39:19 +01:00
esac
shift
else
launch
fi