背景

用cf的tunenl与二级域名打通内网服务FileBrowser,Alist后,顺便想多挂几个smb的局域网的共享, 并加入 alpine 的开机启动脚本中。

FileBrowser开机启动

FileBrowser安装在Docker中,加入开机启动,只需要把 run -d 脚本转换为docker-compose 即可,脚本:

docker-commpse.yml
version: '3'
services:
  filebrowser:
    image: filebrowser/filebrowser:latest
    container_name: filebrowser
    restart: always
    ports:
      - "8089:80/tcp"
    networks:
      - net
    volumes:
      - /path/to/filebrowser/srv:/srv
      - /path/to/filebrowser/filebrowser.db:/database.db
      - /path/to/filebrowser/filebrowser.json:/filebrowser.json
      - /etc/localtime:/etc/localtime:ro
networks:
  net:
    driver: bridge
filebrowser.json
{
  "port": 80,
  "baseURL": "",
  "address": "",
  "log": "stdout",
  "database": "/database.db",
  "root": "/srv"
}

image-1706421346308

alpine安装cifs

apk add  cifs-utils
GPT 讲解参数

image-1706421622404

GPT生成alpine开机启动脚本

#!/sbin/openrc-run

depend() {
  need localmount net
}

start() {
  ebegin "Mounting SMB Share"
  modprobe cifs
  mount -t cifs //192.168.x.x/ShareData /path/to/share/folder -o credentials=/etc/smbcredentials,rw,uid=0,gid=0,_netdev
  eend $?
}

stop() {
  ebegin "Unmounting SMB Share"
  umount /path/to/share/folder
  eend $?
}
把脚本加入 开机服务

image-1706421414549

Filebrowser 与alist 完美互补

image-1706421993563