文件同步
·89 words·1 min
服务器
文件同步
Syncthing
在 Ubuntu 上以 root 用户运行 Syncthing #
如果你希望以 root 用户身份运行 Syncthing,以下是将其注册为服务的步骤:
1. 安装 Syncthing #
如果你还没有安装 Syncthing,可以按照官方的安装说明进行安装。
2. 创建 Systemd 服务文件 #
sudo nano /etc/systemd/system/syncthing.service
然后添加以下内容:
ini
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=network.target
[Service]
User=填写一个username
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
ProtectHome=read-only
[Install]
WantedBy=multi-user.target
3. 重新加载 Systemd #
sudo systemctl daemon-reload
4. 启用并启动服务 #
sudo systemctl enable syncthing.service
sudo systemctl start syncthing.service
5. 检查服务状态 #
sudo systemctl status syncthing.service
现在,每次系统启动时,Syncthing 都应该自动在后台运行。
6.启用Lingering让服务持续运行即使ssh连接断开 #
loginctl enable-linger username
321
Related
Big Cats
·1182 words·6 mins
English
Big Cats
Okinawa: The Island of Longevity
·837 words·4 mins
English
wordlist
养生秘诀
·35 words·1 min
养生
吃饭