Skip to content

check_mount_daemon is a lightweight Go daemon designed for Feiniu OS (FNOS) to ensure that a bind mount is always active.

Notifications You must be signed in to change notification settings

zhang3woshi/check_mount_daemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

项目简介

自动在飞牛“我的文件”目录下创建远程挂载目录的软链接,以解决安装盘空间过小无法备份相册问题

1. 编译:

set GOOS = linux
# 此处根据需要修改(amd64,arm64等)
set GOARCH = amd64
go build -o check_mount_daemon check_mount_daemon.go

将编译后文件以及配置文件放置于/usr/local/bin
/usr/local/bin

​ |

​ |----check_mount_daemon

​ |----config.json

2. 修改config.json配置文件(支持挂载多个目录)

{
  "mounts": [
    {
      "source": "/vol02/1000-0-1fd91f9b/Picture",
      "target": "/vol1/1000/Photos/"
    },
    {
      "source": "/vol02/1001-1-750eb99a/Photos",
      "target": "/vol1/1001/Photos"
    }
  ]
}

3. 创建remote文件

在源文件夹根目录创建remote文件,用于判断是否需要再次挂载,例如:/vol02/1000-0-122ea9fa/Photos/remote

4. 新建服务文件: /etc/systemd/system/check-mount.service

[Unit]
Description=Auto check and bind mount fnos-data
After=network-online.target

[Service]
ExecStart=/usr/local/bin/check_mount_daemon
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

5. 启动并设置开机自启:

sudo systemctl daemon-reload
sudo systemctl enable --now check-mount.service
# 停止服务
sudo systemctl stop check-mount.service
# 查看状态
sudo systemctl status check-mount.service

TODO

  1. 将项目打包为deb安装包,直接安装使用

About

check_mount_daemon is a lightweight Go daemon designed for Feiniu OS (FNOS) to ensure that a bind mount is always active.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages