Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

请问有没有办法设置服务器重启后,延迟启动某个应用(docker容器)

Featured Replies

本人现在手上除了unraid外还有一个QNAP的nas,现在emby通过nfs远程挂载QNAP的存储池,然后放在unraid的emby上刮削。

但是今天unraid服务器重启后,过了一段时间去看emby,里面的媒体库还在,但是媒体资料都消失了,重新扫描资料库可以刮削到数据。

本人猜测是插件后于docker启动挂载硬盘,导致容器映射远程挂载路径到容器内部失败,然后在重启到我查看emby的这段时间,emby的自动扫描资料库任务启动了,随后emby认为媒体资料消失就把媒体资料删除了。

虽然现在可以把自动扫描资料库的任务禁用保证emby不会再自动删除媒体资料,但是每次重启后得手动重启一次emby容器才能保证容器将远程路径映射到容器中去,不然播放的时候会报错

虽然我想到可以使用开机脚本定时将容器重启,但是有没有办法实现某个容器在远程挂载成功后再启动以根本解决问题?

  • Author
#!/bin/bash
DIRECTORY_1=/mnt/remotes/453DMINI_Mydownload/Transmission_Download/动画/
DIRECTORY_2=/mnt/remotes/453DMINI_Mydownload/Transmission_Download/国漫/
DIRECTORY_3=/mnt/remotes/453DMINI_Mydownload/Transmission_Download/电影/
DIRECTORY_4=/mnt/remotes/453DMINI_Mydownload/Transmission_Download/电视剧/
while true
do
  sleep 5s;
  if ["`ls -A $DIRECTORY_1`" = ""] || ["`ls -A $DIRECTORY_2`" = ""] || ["`ls -A $DIRECTORY_3`" = ""] || ["`ls -A $DIRECTORY_4`" = ""]; then
    echo "No Path!"
  else
    docker restart Emby;
    break;
  fi
done

通过观察发现,远程挂载失败的时候代码中目录1234的底下的文件是不存在的,使用User Script脚本开机检测目录1234下是否有文件,有文件有重启名为Emby的容器即可(最好把容器的开机自启动关闭,通过脚本启动)

不过搞不懂的是通过nfs挂载的远端存储unmount以后会在remotes目录的深处留下子目录,而smb挂载的远端存储unmount后则是直接从remotes目录下消失,如果用smb的话上面的脚本可以直接检测/mnt/remotes下有没有453Dmini的文件夹即可

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.