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/easyexplorer/bin/easyexplorer_darwin_x86_64
Normal file
BIN
apps/easyexplorer/bin/easyexplorer_darwin_x86_64
Normal file
Binary file not shown.
BIN
apps/easyexplorer/bin/easyexplorer_linux_arm
Normal file
BIN
apps/easyexplorer/bin/easyexplorer_linux_arm
Normal file
Binary file not shown.
BIN
apps/easyexplorer/bin/easyexplorer_linux_x86_64
Normal file
BIN
apps/easyexplorer/bin/easyexplorer_linux_x86_64
Normal file
Binary file not shown.
7
apps/easyexplorer/config/easyexplorer.uci
Normal file
7
apps/easyexplorer/config/easyexplorer.uci
Normal file
@@ -0,0 +1,7 @@
|
||||
service="EasyExplorer"
|
||||
appname="easyexplorer"
|
||||
needver="0.0.1"
|
||||
supports="linux_arm,linux_x86_64,darwin_x86_64"
|
||||
appinfo="一款跨设备的P2P文件同步工具"
|
||||
newinfo="修复程序无法运行的bug,更新二进制版本为最新版"
|
||||
version="0.0.5"
|
||||
31
apps/easyexplorer/config/mixbox.conf
Normal file
31
apps/easyexplorer/config/mixbox.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
#------------------【EasyExplorer】--------------------
|
||||
easyexplorer() {
|
||||
|
||||
eval `mbdb export easyexplorer`
|
||||
source /etc/mixbox/bin/base
|
||||
echo "********* $service ***********"
|
||||
echo "[${appinfo}]"
|
||||
readsh "启动${appname}服务[1/0] " "enable" "1"
|
||||
if [ "$enable" == '1' ]; then
|
||||
read -p "修改${appname}文件共享目录(`mbdb get ${appname}.main.share_path || echo $mbdisk`)?[1/0] " res
|
||||
if [ "$res" == '1' ]; then
|
||||
read -p "请输入${appname}文件共享目录(回车默认$mbdisk):" res
|
||||
[ ! -z $res ] && mbdb set $appname.main.share_path="$res" || mbdb set $appname.main.share_path="$mbdisk"
|
||||
fi
|
||||
echo "请在https://www.ddnsto.com/注册获取秘钥(token)"
|
||||
[ -z $token ] && token="空"
|
||||
read -p "修改${appname}秘钥($token)?[1/0] " res
|
||||
if [ "$res" == '1' ]; then
|
||||
read -p "请输入${appname}秘钥:" res
|
||||
mbdb set $appname.main.token="$res"
|
||||
fi
|
||||
readsh "请输入${appname}运行端口号" "port" "8890"
|
||||
readsh "请输入${appname}外网访问配置[1/0]" "openport" "1"
|
||||
|
||||
${mbroot}/apps/${appname}/scripts/${appname}.sh restart
|
||||
else
|
||||
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
|
||||
fi
|
||||
|
||||
}
|
||||
#------------------【EasyExplorer】--------------------
|
||||
74
apps/easyexplorer/scripts/easyexplorer.sh
Normal file
74
apps/easyexplorer/scripts/easyexplorer.sh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
source /etc/mixbox/bin/base
|
||||
eval `mbdb export easyexplorer`
|
||||
|
||||
path=$(mbdb get ${appname}.main.share_path) || path="$mbdisk"
|
||||
port=$(mbdb get ${appname}.main.port) || port=8890
|
||||
|
||||
|
||||
set_config() {
|
||||
|
||||
[ ! -d "$path" ] && mkdir -p $path
|
||||
token=$(mbdb get ${appname}.main.token)
|
||||
[ -z "$token" ] && logsh "【$service】" "未配置${appname}的密钥" && exit
|
||||
|
||||
}
|
||||
|
||||
start () {
|
||||
|
||||
if [ "$model" != "arm" ]; then
|
||||
logsh "【$service】" "${appname}服务仅支持arm路由器,准备卸载"
|
||||
${mbroot}/scripts/appmanage.sh del ${appname}
|
||||
exit
|
||||
fi
|
||||
result=$(ps | grep ${mbroot}/apps/${appname}/bin | grep -v grep | wc -l)
|
||||
if [ "$result" != '0' ];then
|
||||
logsh "【$service】" "${appname}已经在运行!"
|
||||
exit 1
|
||||
fi
|
||||
logsh "【$service】" "正在启动${appname}服务... "
|
||||
|
||||
set_config
|
||||
|
||||
# open_port
|
||||
# write_firewall_start
|
||||
|
||||
daemon ${mbroot}/apps/${appname}/bin -fe 0.0.0.0:${port} -u $token -share $path -c ${mbtmp}
|
||||
if [ $? -ne 0 ]; then
|
||||
logsh "【$service】" "启动${appname}服务失败!"
|
||||
else
|
||||
logsh "【$service】" "启动${appname}服务完成!"
|
||||
logsh "【$service】" "请在浏览器中访问[http://$lanip:${port}]"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
stop () {
|
||||
|
||||
logsh "【$service】" "正在停止${appname}服务... "
|
||||
service_stop ${mbroot}/apps/${appname}/bin
|
||||
killall -9 ${appname} &> /dev/null
|
||||
|
||||
}
|
||||
|
||||
|
||||
status() {
|
||||
|
||||
result=$(pssh | grep ${mbroot}/apps/${appname}/bin | grep -v grep | wc -l)
|
||||
if [ "$result" == '0' ]; then
|
||||
status="未运行|0"
|
||||
else
|
||||
status="运行端口号:${port},共享目录: $path|1"
|
||||
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