From 946a11e8730404faa71e42db836c50fa4ab192a5 Mon Sep 17 00:00:00 2001 From: monlor Date: Wed, 10 Jul 2024 16:37:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AA=92=E4=BD=93=E5=9C=B0=E5=9D=80=E8=A7=A3=E6=9E=90=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alist/update_media_addr.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/alist/update_media_addr.sh b/alist/update_media_addr.sh index 748f0c2..1be937e 100755 --- a/alist/update_media_addr.sh +++ b/alist/update_media_addr.sh @@ -56,6 +56,12 @@ get_addr() { fi } +echo "等待emby.js创建完成..." +while ! test -f /etc/nginx/http.d/emby.js; do + sleep 2 +done + +echo "开始更新媒体服务地址..." # 设置一个循环每1分钟检查一次emby的地址是否变化,如果变化就更新/data/emby_server.txt while true; do nginx_reload=0 @@ -65,7 +71,8 @@ while true; do if [ "$NEW_EMBY_ADDR" != "$OLD_EMBY_ADDR" ]; then echo "$NEW_EMBY_ADDR" > /data/emby_server.txt # 更新nginx配置 - sed -i "s#set \$emby .*#set \$emby $NEW_EMBY_ADDR;#" /etc/nginx/http.d/emby.conf + sed -i "s#set \$emby .*#set \$emby ${NEW_EMBY_ADDR};#" /etc/nginx/http.d/emby.conf + sed -i "s#const embyHost .*#const embyHost = '${NEW_EMBY_ADDR}';#" /etc/nginx/http.d/emby.js nginx_reload=1 OLD_EMBY_ADDR=$NEW_EMBY_ADDR echo "Updated emby address to $NEW_EMBY_ADDR" @@ -81,7 +88,8 @@ while true; do if [ "$NEW_JELLYFIN_ADDR" != "$OLD_JELLYFIN_ADDR" ]; then echo "$NEW_JELLYFIN_ADDR" > /data/jellyfin_server.txt # 更新nginx配置 - sed -i "s#set \$emby .*#set \$emby $NEW_JELLYFIN_ADDR;#" /etc/nginx/http.d/jellyfin.conf + sed -i "s#set \$emby .*#set \$emby ${NEW_JELLYFIN_ADDR};#" /etc/nginx/http.d/jellyfin.conf + sed -i "s#const embyHost .*#const embyHost = '${NEW_JELLYFIN_ADDR}';#" /etc/nginx/http.d/jellyfin.js nginx_reload=1 OLD_JELLYFIN_ADDR=$NEW_JELLYFIN_ADDR echo "Updated jellyfin address to $NEW_JELLYFIN_ADDR"