Files
2020-03-05 00:08:40 +08:00

56 lines
1.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#------------------【HttpFile】--------------------
httpfile() {
eval `mbdb export httpfile`
source /etc/mixbox/bin/base
echo "********* $service ***********"
echo "[${appinfo}]"
echo "[如需使用ONMP请停止本插件]"
[ -z "$(mbdb show entware)" ] && echo "请先安装Entware插件" && return
readsh "启动${appname}服务[1/0] " "enable" "1"
if [ "$enable" == '1' ]; then
echo "${appname}全部配置: "
allinfo=$(mbdb show $appname.web)
[ -z "$allinfo" ] && echo "未添加配置!" || echo "$allinfo"
read -p "是否要更改${appname}配置?[1/0] " res
if [ "$res" == '1' ]; then
read -p "添加${appname}配置?[1/0] " res
if [ "$res" == '1' ]; then
while(true)
do
read -p "请输入${appname}配置名称: " name
read -p "请输入${appname}运行端口号: " port
read -p "请输入${appname}访问路径: " path
if [ -z "$name" -o -z "${port}" -o -z "$path" ]; then
echo "配置不能为空,未添加!"
else
mbdb set $appname.web.$name="${port},$path"
fi
echo "已添加配置[$name $path ${port}]"
read -p "继续添加配置?[1/0] " res
[ "$res" == '0' -o -z "$res" ] && break
done
fi
read -p "删除${appname}配置?[1/0] " res
if [ "$res" == '1' ]; then
read -p "清空配置再添加?[1/0] " res
[ "$res" == '1' ] && mbdb clear $appname.web
echo "["$(mbdb keys $appname.web)"]"
while(true)
do
read -p "请输入要删除的配置名: " res
[ ! -z "$res" ] && mbdb del $appname.web.$res
read -p "继续删除配置?[1/0] " res
[ "$res" == '0' -o -z "$res" ] && break
done
fi
fi
readsh "请输入${appname}外网访问配置[1/0]" "openport" "1"
${mbroot}/apps/${appname}/scripts/${appname}.sh restart
else
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
fi
}
#------------------【HttpFile】--------------------