mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
#!/bin/bash
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
|
|
|
mw_path={$SERVER_PATH}
|
|
|
|
mw_start(){
|
|
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
|
if [ "$isStart" == '' ];then
|
|
echo -e "Starting mw... \c"
|
|
cd $mw_path && gunicorn -c setting.py app:app &
|
|
sleep 0.1
|
|
port=$(cat ${mw_path}/data/port.pl)
|
|
isStart=$(lsof -i :$port|grep LISTEN)
|
|
if [ "$isStart" == '' ];then
|
|
echo -e "\033[31mfailed\033[0m"
|
|
echo '------------------------------------------------------'
|
|
tail -n 20 $panel_path/logs/error.log
|
|
echo '------------------------------------------------------'
|
|
echo -e "\033[31mError: mw service startup failed.\033[0m"
|
|
return;
|
|
fi
|
|
echo -e "\033[32mdone\033[0m"
|
|
else
|
|
echo "Starting mw... mw(pid $(echo $isStart)) already running"
|
|
fi
|
|
}
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
'start')
|
|
mw_start
|
|
;;
|
|
esac |