mirror of
https://github.com/monlor/MIXBOX-ARCHIVE.git
synced 2026-03-10 23:41:27 +00:00
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
#------------------【FireWall】--------------------
|
|
firewall() {
|
|
|
|
eval `mbdb export firewall`
|
|
source /etc/mixbox/bin/base
|
|
echo "********* $service ***********"
|
|
echo "[${appinfo}]"
|
|
readsh "启动${appname}服务[1/0] " "enable" "1"
|
|
|
|
if [ "$enable" == '1' ]; then
|
|
echo "已开放端口(工具箱插件默认已开通端口): "
|
|
allport=$(mbdb show $appname.openport)
|
|
[ -z "$allport" ] && echo "没有开通端口!" || echo "$allport"
|
|
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 "请输入配置名称: " name
|
|
read -p "请输入开通端口(列入70或70,80,10或100:110): " port
|
|
if [ ! -z "$name" -a ! -z "${port}" ]; then
|
|
mbdb set $appname.openport.$name="${port}"
|
|
else
|
|
echo "配置为空,未添加!"
|
|
fi
|
|
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.openport
|
|
echo "`mbdb keys $appname.openport`"
|
|
while(true)
|
|
do
|
|
read -p "请输入要删除的配置名: " res
|
|
[ ! -z "$res" ] && mbdb del $appname.openport.$res
|
|
read -p "继续删除配置?[1/0] " res
|
|
[ "$res" == '0' -o -z "$res" ] && break
|
|
done
|
|
fi
|
|
fi
|
|
|
|
${mbroot}/apps/${appname}/scripts/${appname}.sh restart
|
|
else
|
|
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
|
|
fi
|
|
|
|
}
|
|
#------------------【FireWall】-------------------- |