下载的syncthing:syncthing-linux-amd64-v1.19.2.tar.gz
tar -zxvf syncthing-linux-amd64-v1.19.2.tar.gz 解压后将内部文件放到
home/USERNAME/programs/syncthing目录下。
1:supervisorctl
安装好supervisorctl后,新建配置syncthing.conf并填入以下内容
可参考(Starting Syncthing Automatically — Syncthing documentation)
[program:syncthing]
command=/home/USERNAME/programs/syncthing/syncthing --no-browser -gui-address="0.0.0.0:8384" --home="/home/USERNAME/.config/syncthing"
directory=/home/USERNAME/programs/syncthing
user=USERNAME
autostart=true
autorestart=true
environment = STNORESTART="1",HOME="/home/USERNAME"
su->supervisorctl relaod (重启supervisord)->supervisorctl 查看状态
2:systemctl
复制一份解压后的etc/linux-systemd/system/syncthing@.service文件放到/etc/systemd/system目录下,并改名为syncthing@USERNAME.service(不改名也行,我这是自己的需要)
进入etc/linux-systemd/system目录后使用root执行
cp syncthing@.service /etc/systemd/system/syncthing@USERNAME.service
然后编辑syncthing@USERNAME.service,将/usr/local/bin/改为你解压后内部文件所在的目录
我的是/home/USERNAME/programs/syncthing/
然后 systemctl daemon-reload(类似supervisorctl relaod)
systemctl start?syncthing@USERNAME.service 启动
systemctl stop syncthing@USERNAME.service 关闭
systemctl enable syncthing@USERNAME.service 开机启动
本文参考:在CentOS 8/CentOS 7上安装和配置Syncthing的方法_Linux云服务器_云网牛站
Starting Syncthing Automatically — Syncthing documentation
|