树莓派 · 2022年12月28日 0

树莓派docker 安装 jellyfin 自动挂载smb

使用docker-compose 安装 jellyfin

---
version: "2.1"
services:
  jellyfin:
    image: lscr.io/linuxserver/jellyfin:latest
    container_name: jellyfin
    environment:
      - PUID=1000
      - PGID=1000
    devices:
      - /dev/video10:/dev/video10
      - /dev/video11:/dev/video11
      - /dev/video12:/dev/video12
    volumes:
      - /home/pi/jellyfin/config:/config
      - /media/pi/:/data
    ports:
      - 8096:8096
      - 8920:8920 #optional
      - 7359:7359/udp #optional
      - 1900:1900/udp #optional
    restart: unless-stopped

解决jellyfin 方块乱码问题,安装字体包

# 打开容器bash
sudo docker exec -it jellyfin /bin/bash
# 更新apt
apt update
# 安装中文字体库
apt install fonts-noto-cjk-extra

crontab 每分钟检测配置

# 编辑crontab
sudo crontab -e

# 添加如下定时任务
* * * * * sudo /home/pi/jellyfin/smb.mount.sh 2>&1 >> /home/pi/jellyfin/smb.mount.log &

自动检测smb并重新挂载脚本

#!/bin/bash

echo "start checking smb mount point"

if [[ -d /media/pi/.t ]]; then
  echo "smb mounted"
else
  echo "mounting smb";
  mount.cifs //[smb service]/video /media/pi/ -o username=[smb user name],password=[smb user password],uid=pi,gid=pi
  if [[ -d /media/pi/[mount test dir] ]]; then
    echo "mount smb success, and restart jellyfin...";
    docker restart jellyfin
    if [[ $? == 0 ]]; then
      echo "restart jellyfin success"
    else
      echo "restart jellyfin fail"
    fi
  fi
fi