mirror of
https://github.com/monlor/MIXBOX-ARCHIVE.git
synced 2026-03-10 23:41:27 +00:00
moxbox init
This commit is contained in:
BIN
apps/npc/bin/npc_linux_arm
Executable file
BIN
apps/npc/bin/npc_linux_arm
Executable file
Binary file not shown.
BIN
apps/npc/bin/npc_linux_mips
Executable file
BIN
apps/npc/bin/npc_linux_mips
Executable file
Binary file not shown.
BIN
apps/npc/bin/npc_linux_x86_64
Executable file
BIN
apps/npc/bin/npc_linux_x86_64
Executable file
Binary file not shown.
21
apps/npc/config/mixbox.conf
Normal file
21
apps/npc/config/mixbox.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
#------------------【NPC】--------------------
|
||||
npc() {
|
||||
|
||||
eval `mbdb export npc`
|
||||
source "$(mbdb get mixbox.main.path)"/bin/base
|
||||
echo "********* $service ***********"
|
||||
echo "[${appinfo}]"
|
||||
readsh "启动${appname}服务[1/0] " "enable" "1"
|
||||
if [ "$enable" == '1' ]; then
|
||||
# Scripts Here
|
||||
readsh "请输入npc连接命令:" "connect_cmd"
|
||||
|
||||
# readsh "请输入${appname}外网访问配置[1/0]" "openport" "0"
|
||||
readsh "重启${appname}服务[1/0] " "res" "1"
|
||||
[ "$res" = '1' -o -z "$res" ] && ${mbroot}/apps/${appname}/scripts/${appname}.sh restart
|
||||
else
|
||||
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
|
||||
fi
|
||||
|
||||
}
|
||||
#------------------【NPC】--------------------
|
||||
8
apps/npc/config/npc.uci
Normal file
8
apps/npc/config/npc.uci
Normal file
@@ -0,0 +1,8 @@
|
||||
service="NPC"
|
||||
appname="npc"
|
||||
needver="0.0.1"
|
||||
backupfiles=""
|
||||
supports="linux_arm,linux_mips,linux_x86_64"
|
||||
appinfo="一款轻量级、高性能、功能强大的内网穿透代理服务器"
|
||||
newinfo=""
|
||||
version="0.0.7"
|
||||
71
apps/npc/scripts/npc.sh
Normal file
71
apps/npc/scripts/npc.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
#copyright by monlor
|
||||
eval `mbdb export npc`
|
||||
source "$(mbdb get mixbox.main.path)"/bin/base
|
||||
port=""
|
||||
|
||||
start() {
|
||||
|
||||
[ -n "$(pidof ${appname})" ] && logsh "【$service】" "${appname}已经在运行!" && exit 1
|
||||
logsh "【$service】" "正在启动${appname}服务... "
|
||||
# cru a "${appname}" "0 6 * * * ${mbroot}/apps/${appname}/scripts/${appname}.sh restart"
|
||||
# Scripts Here
|
||||
|
||||
# open_port
|
||||
# write_firewall_start
|
||||
[ -z "${connect_cmd}" ] && echo "连接命令未设置!" && end
|
||||
connect_cmd="$(echo "$connect_cmd" | sed -e "s#^\./#${mbroot}/apps/${appname}/bin/#")"
|
||||
# 这里有参数,所以不加引号
|
||||
daemon ${connect_cmd}
|
||||
if [ $? -ne 0 ]; then
|
||||
logsh "【$service】" "启动${appname}服务失败!" && end
|
||||
else
|
||||
logsh "【$service】" "启动${appname}服务完成!"
|
||||
# logsh "【$service】" "请在浏览器打开地址:http://$lanip:$port"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
logsh "【$service】" "正在停止${appname}服务... "
|
||||
[ "$enable" == '0' ] && destroy
|
||||
# close_port
|
||||
# remove_firewall_start
|
||||
killall -9 ${appname} &> /dev/null
|
||||
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
# End app, Scripts here
|
||||
# cru d "${appname}"
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
end() {
|
||||
|
||||
mbdb set ${appname}.main.enable=0
|
||||
stop && exit 1
|
||||
|
||||
}
|
||||
|
||||
status() {
|
||||
|
||||
if [ -n "$(pidof ${appname})" ]; then
|
||||
status="运行中|1"
|
||||
else
|
||||
status="未运行|0"
|
||||
fi
|
||||
mbdb set ${appname}.main.status="$status"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start) start ;;
|
||||
stop) stop ;;
|
||||
restart) stop; start ;;
|
||||
reload) close_port && open_port ;;
|
||||
status) status ;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user