You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
609 B
Bash

#!/bin/bash
export PYTHONPATH=$PWD
STORE_CONTEXT=`echo $STORE_CONTEXT`
if [ -z "$STORE_CONTEXT" ]; then
STORE_CONTEXT='store'
fi
install(){
virtualenv sandbox
sandbox/bin/pip install -r requirements.txt
}
start(){
python3 api/index.py --path $PWD/config.json --port 8084 --context $STORE_CONTEXT & > out.log
}
stop(){
ps -eo pid,command |grep python |grep $PWD |grep -E "^ {0,}[0-9]+" -o |xargs kill -9
}
check(){
pid=`ps -eo pid,command |grep python |grep $PWD |grep -E "^ {0,}[0-9]+" -o -m 1`
if [ "$pid" ]; then
echo "*** Online $pid"
else
echo "*** Offline"
fi
}
status(){
check
}
$1