From cb7553149308985608219b7e51748180e2ee0f2a Mon Sep 17 00:00:00 2001 From: David White Date: Tue, 8 Oct 2024 12:27:14 +0100 Subject: [PATCH] Change the way syncthing started --- ZelBack/src/services/syncthingService.js | 83 +++++++++++------------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/ZelBack/src/services/syncthingService.js b/ZelBack/src/services/syncthingService.js index f86160264..77277e92f 100644 --- a/ZelBack/src/services/syncthingService.js +++ b/ZelBack/src/services/syncthingService.js @@ -2396,28 +2396,28 @@ async function adjustSyncthing() { * @returns {Promise} */ async function configureDirectories() { - // if (stc.aborted) return; + if (stc.aborted) return; - // const homedir = os.homedir(); - // const configDir = path.join(homedir, '.config'); - // const syncthingDir = path.join(configDir, 'syncthing'); + const homedir = os.homedir(); + const configDir = path.join(homedir, '.config'); + const syncthingDir = path.join(configDir, 'syncthing'); - // const user = os.userInfo().username; - // const owner = `${user}:${user}`; + const user = os.userInfo().username; + const owner = `${user}:${user}`; - // await serviceHelper.runCommand('mkdir', { - // params: ['-p', syncthingDir], - // }); + await serviceHelper.runCommand('mkdir', { + params: ['-p', syncthingDir], + }); - // await serviceHelper.runCommand('chown', { - // runAsRoot: true, - // params: [owner, configDir], - // }); + await serviceHelper.runCommand('chown', { + runAsRoot: true, + params: [owner, configDir], + }); - // await serviceHelper.runCommand('chown', { - // runAsRoot: true, - // params: [owner, syncthingDir], - // }); + await serviceHelper.runCommand('chown', { + runAsRoot: true, + params: [owner, syncthingDir], + }); } /** @@ -2495,10 +2495,11 @@ async function runSyncthingSentinel() { log.error('Unable to get syncthing deviceId. Reconfiguring syncthing.'); await stopSyncthing(); await installSyncthingIdempotently(); - await configureDirectories(); + // await configureDirectories(); - const homedir = os.homedir(); - const syncthingHome = path.join(homedir, '.config/syncthing'); + // const homedir = os.homedir(); + // const syncthingHome = path.join(homedir, '.config/syncthing'); + const syncthingHome = '/dat/usr/lib/syncthing'; const logFile = path.join(syncthingHome, 'syncthing.log'); if (stc.aborted) return 0; @@ -2516,32 +2517,26 @@ async function runSyncthingSentinel() { // adding old spawn with shell in the interim. childProcess.spawn( - `sudo nohup syncthing --logfile ${logFile} --logflags=3 --log-max-old-files=2 --log-max-size=26214400 --allow-newer-config --no-browser --home ${syncthingHome} >/dev/null 2>&1