加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run.sh 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
Simon 提交于 2020-11-18 18:05 . dev--pom重构
#!/bin/sh
# shellcheck disable=SC2034
RUNNING_USER=root
ADATE=`date +%Y%m%d%H%M%S`
NAME=$2
METHOD=$3
deploy(){
cd /var/app/server || exit
if [ -f "$NAME-bin.zip" ]; then
lsattr -a $NAME/*
lsattr -i $NAME/*
rm -rf $NAME/*
unzip -o $NAME-bin.zip
cd $NAME || exit
echo "sh ./run-$NAME.sh deploy"
sh ./run-$NAME.sh deploy
fi
}
start(){
cd /var/app/server/$NAME || exit
if [ -f "run-$NAME.sh" ]; then
echo "sh ./run-$NAME.sh start"
sh ./run-$NAME.sh start
fi
}
stop(){
cd /var/app/server/$NAME || exit
if [ -f "run-$NAME.sh" ]; then
echo "sh ./run-$NAME.sh stop"
sh ./run-$NAME.sh stop
fi
}
script(){
cd /var/app/server/$NAME || exit
echo "sh ./run-$NAME.sh $METHOD"
sh ./run-$NAME.sh $METHOD
}
case $1 in
deploy) deploy;;
start) start;;
stop) stop;;
script) script;;
*) echo "参数1=>执行方法,参数2=>app名称,参数3=>script方法\n方法: deploy 部署|start 启动|stop 停止|script 执行对应app run-*.sh " ;;
esac
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化