docker部署
docker run -d \
--name syncthing \
--restart unless-stopped \
--network host \
-v /mnt/sata/syncthing/config:/var/syncthing/config \
-v /mnt/sata/syncthing/data:/mnt/sata \
--log-opt max-size=10m \
--log-opt max-file=3 \
syncthing/syncthing
log指定大小单个文件最大max-size,最多几个文件max-file
部署安装方式
下载syncthing-linux-amd64-vx.xx.xx.tar.gz
wget https://github.com/syncthing/syncthing/releases/download/v1.29.3/syncthing-linux-amd64-v1.29.3.tar.gz
官网地址:https://syncthing.net/downloads/
解压
将解压的文件夹命名为syncthing
tar -zxf syncthing-linux-amd64-v1.29.3.tar.gz -C /root/
删除压缩包
rm -rf syncthing-linux-amd64-v1.29.3.tar.gz
改文件名
mv ~/syncthing-linux-amd64-v1.29.3 ~/syncthing
设置服务
创建一个服务
echo '1' > /etc/systemd/system/[email protected]
写入服务
cat <<EOF > /etc/systemd/system/[email protected]
[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=/root/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
# 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
EOF
启动服务
chmod +x /etc/systemd/system/[email protected]
systemctl daemon-reload
systemctl enable [email protected]
systemctl start [email protected]
systemctl status [email protected]
评论区