#!/bin/bash export PYTHONPATH=$PWD/src install(){ virtualenv sandbox sandbox/bin/pip install -r requirements.txt } start(){ sandbox/bin/python src/api/index.py --path $PWD/config.json --port 8084 --context payment & > 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