PR-decision-bot/pr-decision-bot.sh

42 lines
593 B
Bash
Raw Normal View History

2021-08-20 10:25:20 +08:00
#!/bin/bash
2021-08-20 10:30:34 +08:00
AppName="pr-decision-bot"
2021-08-20 10:25:20 +08:00
App="~/app/pr-decision-bot.py"
echo $1
echo $App
function killProcess() {
NAME=$1
echo $NAME
PID=$(ps -e | grep $NAME | awk '{print $1}')
echo "PID: $PID"
kill -9 $PID
}
function start() {
echo "start $AppName"
nohup python -u $App > server.log 2>&1 &
}
function stop() {
echo "stop $AppName"
killProcess $AppName
}
function restart() {
echo "restart $AppName"
stop
start
}
case "$1" in
2021-08-20 10:30:34 +08:00
start)
2021-08-20 10:25:20 +08:00
start
2021-08-20 10:30:34 +08:00
;;
stop)
2021-08-20 10:25:20 +08:00
stop
2021-08-20 10:30:34 +08:00
;;
restart)
2021-08-20 10:25:20 +08:00
restart
2021-08-20 10:30:34 +08:00
;;
2021-08-20 10:25:20 +08:00
esac