Merge pull request #876 from dhsifss/main

feat: add tengine reset script
This commit is contained in:
xbingW
2024-05-14 15:45:03 +08:00
committed by GitHub
3 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#!/bin/bash
set -e
SCRIPT_DIR=$(dirname "$0")
confirm() {
echo -e -n "\033[34m[SafeLine] $* \033[1;36m(Y/n)\033[0m"
read -n 1 -s opt
[[ "$opt" == $'\n' ]] || echo
case "$opt" in
'y' | 'Y' ) return 0;;
'n' | 'N' ) return 1;;
*) confirm "$1";;
esac
}
if ! confirm "是否清空所有 tengine 的所有站点配置(清空后需要在管理页面重新生成站点配置)"; then
exit 0
fi
if [ ! -d "${SCRIPT_DIR}/resources/nginx" ]; then
echo "website dir not found"
exit 1
fi
mv "${SCRIPT_DIR}"/resources/nginx "${SCRIPT_DIR}"/resources/nginx."$(date +%s)"
docker restart safeline-tengine

View File

@@ -210,6 +210,7 @@ info "创建安装目录 '$safeline_path' 成功"
cd "$safeline_path"
curl "https://waf-ce.chaitin.cn/release/latest/compose.yaml" -sSLk -o compose.yaml
curl "https://waf-ce.chaitin.cn/release/latest/reset_tengine.sh" -sSLk -o reset_tengine.sh
if [ $? -ne "0" ]; then
abort "下载 compose.yaml 脚本失败"

View File

@@ -212,6 +212,7 @@ fi
mv $compose_name $compose_name.old
curl "https://waf-ce.chaitin.cn/release/latest/compose.yaml" -sSLk -o $compose_name
curl "https://waf-ce.chaitin.cn/release/latest/reset_tengine.sh" -sSLk -o reset_tengine.sh
if [ $? -ne "0" ]; then
abort "下载 compose.yaml 脚本失败"