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

42 lines
588 B
Bash
Raw Permalink Normal View History

2021-08-20 10:25:20 +08:00
#!/bin/bash
2021-08-21 11:11:32 +08:00
AppName="pr-decision-bot.py"
2021-08-20 10:31:52 +08:00
App="app/pr-decision-bot.py"
2021-08-20 10:25:20 +08:00
echo $1
function killProcess() {
NAME=$1
echo $NAME
2021-08-20 11:00:07 +08:00
PID=$(ps -ef | grep $NAME | awk '{print $2}')
2021-08-20 10:25:20 +08:00
echo "PID: $PID"
kill -9 $PID
}
function start() {
echo "start $AppName"
2021-08-20 10:31:52 +08:00
nohup python -u $App > $AppName.log 2>&1 &
2021-08-20 10:25:20 +08:00
}
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-21 11:11:32 +08:00
esac