Syncthing

常用忽略


.obsidian
.stfolder
.svn
.git
*.log
~$*.xlsx
bin
obj
node_modules
dist
vx_notebook
vx.json

常见问题 & 解决办法

同步过程中 权限问题

同步过程中 权限问题

  1. windows <--> linux 同步过程中一直重新扫描(忽略权限后正常)

  2. linux(docker) o--> linux(backup): docker 应用

    部分文件 0130 权限,

    使用过程中 docker 删除文件,backup 权限不足删除不掉并且一直警告

解决办法:

Syncthing service

PI

# 解压
tar -zxf syncthing-linux-amd64-v...
# 重命名
mv syncthing-linux-amd64-v... syncthing
# 启动
./syncthing serve
./syncthing serve --gui-address=0.0.0.0:8384

# 创建 systemctl 
nano /etc/systemd/system/syncthing@shaun.service


nano /etc/systemd/system/syncthing.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=4
 
[Service]
User=%i
ExecStart=/opt/syncthing/syncthing serve --no-browser --no-restart --logflags=0 --gui-address=0.0.0.0:8384
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
Environment=HOME=/opt/syncthing

ExecStartPre=/bin/sleep 60
 
# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
 
# Elevated permissions to sync ownership (disabled by default),
# see https://docs.syncthing.net/advanced/folder-sync-ownership
#AmbientCapabilities=CAP_CHOWN CAP_FOWNER
 
[Install]
WantedBy=multi-user.target

# 启动
sudo systemctl start syncthing@shaun
# 重启
sudo systemctl restart syncthing@shaun
# 停止
sudo systemctl stop syncthing@shaun
# 查看状态
sudo systemctl status syncthing@shaun

# 开机自动启动
sudo systemctl enable syncthing@shaun
# 开机禁用
systemctl disable syncthing@shaun
# 更新开机启动
systemctl daemon-reload

OMV

# 解压
tar -zxf syncthing-...
# 重命名
mv syncthing-... syncthing
# 启动
./syncthing serve
./syncthing serve --gui-address=0.0.0.0:8384

# 创建 systemctl 
nano /etc/systemd/system/syncthing.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
After=network-online.target
Wants=network-online.target

[Service]
User=syncthing
Group=syncthing
Environment=HOME=/var/lib/syncthing
WorkingDirectory=/var/lib/syncthing
ExecStart=/opt/syncthing/syncthing serve --no-browser --no-restart --logflags=0 --gui-address=0.0.0.0:8384
Restart=on-failure
RestartSec=5s
ExecStartPre=/bin/sleep 30

[Install]
WantedBy=multi-user.target

查看日志



journalctl -u syncthing.service -b --no-pager -n 50