I usually run syncthing on a per user basis. Thus, multiple instances are running at the same time. This is currently not supported by the provided init script, since it uses a rc-name independent fixed pidfile (/run/syncthing.pid). Thus is propose the following change to the init script (see attached file) in order to allow multiple instances by symlinking the init script (e.g., /etc/init.d/syncthing -> /etc/init.d/syncthing.username) and providing a matching conf.d file (in the above example /etc/conf.d/syncthing.username): -> Use the following pidfile in the init script. This is backward compatible, i.e., everyting works with the original init script as it was. pidfile="/run/${RC_SVCNAME}.pid" Furthermore, multiple instances usually collide using the same gui port, thus one can add "--gui-address=127.0.0.1:PORT" to SYNCTHING_OPTS in the conf file. Since this is not very convenient, I propose to add an extra option to the conf file: SYNCTHING_GUI_ADDRESS Of course this should default to the previous one by adding SYNCTHING_GUI_ADDRESS=${SYNCTHING_GUI_ADDRESS:-127.0.0.1:8384} to the init stript and use it explicitly in the command opts command_args="-no-browser -home=${SYNCTHING_HOMEDIR} -gui-address=${SYNCTHING_GUI_ADDRESS} ${SYNCTHING_OPTS}" Reproducible: Always
Created attachment 763003 [details] modified syncthing init script
Created attachment 763004 [details] modified syncthing config file
LGTM, thanks!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a121cdb69c3887a83315cb88dbb285712176a779 commit a121cdb69c3887a83315cb88dbb285712176a779 Author: Marek Szuba <marecki@gentoo.org> AuthorDate: 2022-01-27 14:11:01 +0000 Commit: Marek Szuba <marecki@gentoo.org> CommitDate: 2022-01-27 14:15:28 +0000 net-p2p/syncthing: make syncthing OpenRC service ready for multiple instances Thanks-to: Till Schäfer <till2.schaefer@uni-dortmund.de> Closes: https://bugs.gentoo.org/831735 Signed-off-by: Marek Szuba <marecki@gentoo.org> net-p2p/syncthing/files/syncthing.confd | 4 +++ net-p2p/syncthing/files/syncthing.initd-r2 | 33 ++++++++++++++++++++++ ...ng-1.18.6.ebuild => syncthing-1.18.6-r1.ebuild} | 2 +- 3 files changed, 38 insertions(+), 1 deletion(-)