代码拉取完成,页面将自动刷新
#!/bin/bash
function check(){
if [ ! -d "nginx" ];then
echo "未安装nginx,请执行install脚本安装"
exit
fi
}
function start(){
check
if [ -d .env ];then
. .env/bin/activate
fi
## 启动django 和 websockify
cd vmbox-api/
nohup python3 run.py &> ./logs.log &
cd ../ws-scrcpy
nohup node dist/index.js &> ./logs.log &
## 启动nginx
cd ../nginx
./sbin/nginx
cd ..
}
function stop() {
check
ps aux|grep -E 'python3 run.py|python -m websockify|scrcpy' |grep -v 'grep' | awk '{print "kill "$2}' | bash
cd nginx
./sbin/nginx -s stop
cd ..
}
function ng() {
cd nginx
if [ "$1" == "start" ];then
./sbin/nginx
else
./sbin/nginx -s $1
fi
}
case $1 in
start)
start
echo "[start OK]"
exit
;;
esac
case $1 in
stop)
stop
echo "[stop OK]"
exit
;;
esac
case $1 in
restart)
stop
echo "[stop OK]"
start
echo "[start OK]"
echo "[restart OK]"
exit
;;
ng)
ng $2
echo "[nginx OK]"
exit
;;
esac
echo -e '\n请输入参数!\n \ncommand: start.sh [start|stop|restart|ng ${nginxOption}]\n\t\tginxOption: \n\t\t\t [stop|restart]'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。