#!/bin/bash prog="$0" while [ -h "${prog}" ]; do newProg=`/bin/ls -ld "${prog}"` newProg=`expr "${newProg}" : ".* -> \(.*\)$"` if expr "x${newProg}" : 'x/' >/dev/null; then prog="${newProg}" else progdir=`dirname "${prog}"` prog="${progdir}/${newProg}" fi done progdir=`dirname "${prog}"` cd "${progdir}" progdir=$(pwd) # 获取当前脚本的名称 SCRIPT_NAME=$(basename "$0") # 检查是否有相同的脚本在运行(排除当前进程) #if pgrep -f "$SCRIPT_NAME" | grep -v "$$" > /dev/null; then # echo "脚本已在运行,退出..." # exit 1 #fi if [ "$SELFIP" == "" ]; then interface=$(ip route show | grep default | awk '{print $5}') export SELFIP=$(ip addr show $interface | grep -w inet | awk '{print $2}' | cut -d/ -f1|head -1) echo "DETECT SELF IP:${SELFIP}, if this is not correct, change SELFIP to your real ip" fi unset LD_PRELOAD machine=$(uname -m) if [[ "$machine" == *"arm"* || "$machine" == *"aarch"* ]]; then arch="arm64" else arch="amd64" fi echo "arch:$arch" chmod 755 webdav_simulator.$arch WEBDAV_PORT=5678 rm -rf tmp.${WEBDAV_PORT} mkdir tmp.${WEBDAV_PORT} chmod 777 tmp.${WEBDAV_PORT} export TMPDIR=tmp.${WEBDAV_PORT} while true do curl -v -L "http://127.0.0.1:${WEBDAV_PORT}/dav" if [ $? -ne 0 ]; then # ./webdav_simulator.$arch --selfip $SELFIP --port ${WEBDAV_PORT} --noindex --alist_config alistservers.txt --username guest --password guest_Api789 --proxymode 1 --blackwords '抖音,短剧,音乐22,mp3,wav,flac,BACKUP,BDMV,txt' --fake_media_file fake.mkv --strmmode 'xy115-all.txt.xz#xy-dy.txt.xz#xy-dsj.txt.xz#xy115-music.txt.xz' ./webdav_simulator.$arch --selfip $SELFIP --port ${WEBDAV_PORT} --noindex --alist_config alistservers.txt --username guest --password guest_Api789 --proxymode 1 --blackwords '抖音,短剧,音乐22,mp3,wav,flac,BACKUP,BDMV,txt' --fake_media_file fake.mkv --strmmode 'xy115-all.txt.xz#xy-dy.txt.xz#xy-dsj.txt.xz#xy115-music.txt.xz' echo "webdavsim exit, sleep 5s and restart" else break fi sleep 5 done