From 186dee884ed4b71b44d705fe4c39628cb5147547 Mon Sep 17 00:00:00 2001 From: ZJP Monitor Date: Wed, 2 Jul 2025 19:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6:=20tmuxrun?= =?UTF-8?q?webdavsim.sh,=20rclonemount.sh,=20attach.sh,=20install.sh,=20ru?= =?UTF-8?q?nembysim.sh=20=E7=AD=896=E4=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attach.sh | 3 +++ install.sh | 23 +++++++++++++++-------- killwebdavsim.sh | 10 ++++++++++ rclonemount.sh | 11 +++++++++-- runembysim.sh | 6 +++++- tmuxrunwebdavsim.sh | 7 +++++++ 6 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 attach.sh create mode 100644 killwebdavsim.sh create mode 100644 tmuxrunwebdavsim.sh diff --git a/attach.sh b/attach.sh new file mode 100644 index 0000000..5eefa9e --- /dev/null +++ b/attach.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +tmux attach -t webdavsim diff --git a/install.sh b/install.sh index b04de96..5b73038 100644 --- a/install.sh +++ b/install.sh @@ -18,13 +18,20 @@ progdir=$(pwd) mkdir embysim cd embysim -echo "extract embysim docker image..." -xz -dc -v ../embysim.docker.tar.xz > embysim.docker.tar -echo "extract embysim docker image finish" -echo "load embysim docker to system..." -docker load -i embysim.docker.tar -rm -f embysim.docker.tar -echo "load embysim docker to system finish" +#echo "extract embysim docker image..." +#xz -dc -v ../embysim.docker.tar.xz > embysim.docker.tar +#echo "extract embysim docker image finish" +#echo "load embysim docker to system..." +#docker load -i embysim.docker.tar +#rm -f embysim.docker.tar +#echo "load embysim docker to system finish" +echo "ready to docker pull emby/embyserver:latest..." +docker pull emby/embyserver:latest +if [ $? -ne 0 ]; then + echo "docker pull fail, exit" + exit +fi +echo "docker pull finish" echo "extract embysim data and prog..." tar xf ../embysim.tar.xz @@ -34,7 +41,7 @@ if [ ! -e alistservers.txt ]; then fi echo "copy scripts..." -mv ../webdav_simulator.amd64 ../htdocs ../runwebdavsim.sh ../rclonemount.sh ../runembysim.sh ../rclone.conf ../xy*.txt.xz . +mv ../webdav_simulator.amd64 ../htdocs ../runwebdavsim.sh ../killwebdavsim.sh ../tmuxrunwebdavsim.sh ../attach.sh ../rclonemount.sh ../runembysim.sh ../rclone.conf ../xy*.txt.xz . echo "copy scripts finish" echo "all assets installed" diff --git a/killwebdavsim.sh b/killwebdavsim.sh new file mode 100644 index 0000000..81759d4 --- /dev/null +++ b/killwebdavsim.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +killall -9 runwebdavsim.sh +pidlist=$(ps -ef|grep "/webdav_simulator"|grep -- "--port 5678"|grep -v grep|awk '{print $2}') +for pid in $pidlist +do + echo $pid + kill -9 $pid +done + diff --git a/rclonemount.sh b/rclonemount.sh index 3ca0cbc..ff25372 100644 --- a/rclonemount.sh +++ b/rclonemount.sh @@ -18,7 +18,7 @@ progdir=$(pwd) num=$(mount |grep "/external"|wc -l) if [ $num -lt 1 ]; then - mkdir -p external + mkdir -p external >/dev/null 2>&1 mount -o bind,shared emby.external external echo "mount emby.external to external to mark shared" fi @@ -44,7 +44,14 @@ if [ $? -eq 0 ]; then echo "WARN:webdavsim is running, data may be outdate." else echo "run webdavsim..." - nohup ./runwebdavsim.sh >/dev/null 2>&1 & + tmux -V + if [ $? -eq 0 ]; then + chmod u+x tmuxrunwebdavsim.sh + ./tmuxrunwebdavsim.sh + else + chmod u+x tmuxrunwebdavsim.sh + nohup ./runwebdavsim.sh >/dev/null 2>&1 & + fi fi echo "TRY CONNECT webdavsim, please wait... abount(30s)" diff --git a/runembysim.sh b/runembysim.sh index f841b7c..1bb49bd 100644 --- a/runembysim.sh +++ b/runembysim.sh @@ -24,6 +24,7 @@ docker rm embysim num=$(mount |grep "/external"|wc -l) if [ $num -lt 1 ]; then + mkdir external >/dev/null 2>&1 mount -o bind,shared emby.external external echo "mount emby.external to external to mark shared" fi @@ -40,6 +41,7 @@ num=$(mount |grep "/rclone.media"|wc -l) if [ $num -gt 0 ]; then echo "WARN: rclone.media already mounted, the webdav content may be outdate" else + chmod u+x rclonemount.sh ./rclonemount.sh fi @@ -69,4 +71,6 @@ docker run -d \ --env GIDLIST=100 \ --env SELFIP=${SELFIP} \ --restart on-failure \ - pandagroove/embysim:1.0.0 + emby/embyserver:latest + + #pandagroove/embysim:1.0.0 diff --git a/tmuxrunwebdavsim.sh b/tmuxrunwebdavsim.sh new file mode 100644 index 0000000..7ed877a --- /dev/null +++ b/tmuxrunwebdavsim.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export LANG="zh_CN.UTF-8" +export LC_ALL="zh_CN.UTF-8" +chmod u+x runwebdavsim.sh +tmux new-session -d -s webdavsim "./runwebdavsim.sh" +#./attach.sh