2019-03-04 01:24:49 -05:00
|
|
|
#!/bin/bash
|
2023-11-08 12:32:59 -05:00
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
2022-06-14 03:14:31 -04:00
|
|
|
export PATH
|
2022-10-30 14:30:55 -04:00
|
|
|
export LANG=en_US.UTF-8
|
2019-03-04 01:24:49 -05:00
|
|
|
|
2019-12-12 13:54:48 -05:00
|
|
|
|
|
|
|
|
if [ -f /etc/motd ];then
|
2022-06-11 11:35:15 -04:00
|
|
|
echo "welcome to mdserver-web panel" > /etc/motd
|
2019-12-12 13:54:48 -05:00
|
|
|
fi
|
|
|
|
|
|
2019-09-13 12:26:03 -04:00
|
|
|
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
2019-09-13 06:49:32 -04:00
|
|
|
|
2022-06-20 11:55:33 -04:00
|
|
|
yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel
|
2019-03-13 07:54:45 -04:00
|
|
|
|
|
|
|
|
|
2022-06-13 21:10:06 -04:00
|
|
|
cd /www/server/mdserver-web/scripts && bash lib.sh
|
2021-10-31 12:36:22 -04:00
|
|
|
chmod 755 /www/server/mdserver-web/data
|
2019-03-04 21:04:05 -05:00
|
|
|
|
2023-01-10 04:25:38 -05:00
|
|
|
if [ -f /etc/rc.d/init.d/mw ];then
|
|
|
|
|
bash /etc/rc.d/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/rc.d/init.d/mw
|
|
|
|
|
fi
|
2021-11-03 12:04:08 -04:00
|
|
|
|
2019-03-13 08:14:37 -04:00
|
|
|
echo -e "stop mw"
|
2019-03-13 07:45:55 -04:00
|
|
|
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
2022-06-13 11:51:50 -04:00
|
|
|
|
|
|
|
|
port=7200
|
|
|
|
|
if [ -f /www/server/mdserver-web/data/port.pl ]; then
|
|
|
|
|
port=$(cat /www/server/mdserver-web/data/port.pl)
|
|
|
|
|
fi
|
|
|
|
|
|
2019-03-13 08:07:57 -04:00
|
|
|
n=0
|
|
|
|
|
while [[ "$isStart" != "" ]];
|
|
|
|
|
do
|
|
|
|
|
echo -e ".\c"
|
|
|
|
|
sleep 0.5
|
|
|
|
|
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
|
|
|
|
|
let n+=1
|
2019-04-02 02:09:04 -04:00
|
|
|
if [ $n -gt 15 ];then
|
2019-03-13 08:07:57 -04:00
|
|
|
break;
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 08:14:37 -04:00
|
|
|
echo -e "start mw"
|
2022-11-10 10:14:47 -05:00
|
|
|
cd /www/server/mdserver-web && bash cli.sh start
|
2019-03-13 08:07:57 -04:00
|
|
|
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
|
|
|
|
n=0
|
2022-11-10 10:14:47 -05:00
|
|
|
while [[ ! -f /etc/rc.d/init.d/mw ]];
|
2019-03-13 07:45:55 -04:00
|
|
|
do
|
|
|
|
|
echo -e ".\c"
|
2022-11-10 10:14:47 -05:00
|
|
|
sleep 1
|
2019-03-13 07:45:55 -04:00
|
|
|
let n+=1
|
2022-11-10 10:14:47 -05:00
|
|
|
if [ $n -gt 20 ];then
|
|
|
|
|
echo -e "start mw fail"
|
|
|
|
|
exit 1
|
2019-03-13 07:45:55 -04:00
|
|
|
fi
|
|
|
|
|
done
|
2022-11-10 09:49:24 -05:00
|
|
|
echo -e "start mw success"
|