-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.sh
executable file
·33 lines (28 loc) · 878 Bytes
/
main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
CMD=$1
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PY_PATH="${SCRIPT_DIR}/server.py"
LOG_PATH="${SCRIPT_DIR}/logs/server.log"
ERR_PATH="${SCRIPT_DIR}/logs/server.error"
source ~/miniconda3/etc/profile.d/conda.sh
conda activate base
if [ -z "${CMD}" ]
then
echo "please provide argument: [start | stop | restart]"
else
case "${CMD}" in
"start") nohup python "${PY_PATH}" start 1>>"${LOG_PATH}" 2>>"${ERR_PATH}" &
echo "started"
;;
"stop") python "${PY_PATH}" stop
;;
"restart") python "${PY_PATH}" stop
nohup python "${PY_PATH}" start 1>>"${LOG_PATH}" 2>>"${ERR_PATH}" &
echo "started"
;;
"show") python "${PY_PATH}" show
;;
*) echo "valid argument: [start | stop | restart]"
;;
esac
fi