下载的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:liunx-desktop
解压下载的syncthing安装包,进入etx/linux-desktop,复制syncthing-start.desktop到~/.config/autostart(没有autostart就自己新建)然后修改syncthing-start.desktop文件,将Exec那一行的启动路径改为你实际解压后存放的路径,然后去掉'server'。可以在 --no-browser 后面追加 -gui-address="0.0.0.0:8384",即指定端口为8384,且登录ip为系统ip,否则默认是127.0.0.1,然后重启试试
3: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/
可以在 --no-browser 后面追加 -gui-address="0.0.0.0:8384",即指定端口为8384,且登录ip为系统ip,否则默认是127.0.0.1
然后 systemctl daemon-reload(类似supervisorctl relaod)
systemctl start syncthing@USERNAME.service 启动
systemctl stop syncthing@USERNAME.service 关闭
systemctl enable syncthing@USERNAME.service 开机启动