Software distribution, Some feature suggestions/requests

Let me start by saying that I think syncthing is a realy good tool and that it is amazing how many time you guys put into this (if I look at your git commits), weldone!

I work at a company, that makes machinery (some machinery, specific tools, nothing special).

I tested syncthing for a week now, read a lot of your documentation, liked the community packages… (the qt wrapper is really nice for HMI’s etc) and it is very light weight.

We can exchange logs (multi master to slave), and software (master to multi slave), it all works…we are however struggeling on some points.

I noticed that there were a couple of posts about it, however they all led to different solutions, and there are some issues with running this without control.

Push folders

Since some of the machinery is really remotely located (middle of nowhere)…and the software runs on a secured HMI (without internet explorer). Is it possible to, without ever manipulating the remote device, add a readonly (term used in the xml) folder to this remote device. Workaround is to sync the modified config.xml, replace the config.xml, and restart syncthing. Or use your API. Better is it to just be able to push the folder, and upfront determine the clients folder location.

Feature request: Push type folder, such that the remote device does not has to give permission to add that folder. This is potentially insecure, yes, is it an idea to additionally add a checkbox in devices/advanced to allow this from a specific host or allow this only from a trusted host through modification of the config.xml? , pushfolder= true or something… And have the folder placed in a default directory, or also predetermine the folder location.

I think that the different plugins…are really unfriendly…and require a lot of work in a dynamic environment…(with multiple folders and a serious amount of devices). It is also unfriendly for regular users (that don’t have the knowhow on how to create workarounds)

Post download script can be done by talking to the api, however… If there are different software folders…and some devices have type a, some type b… I know there is a work around (script triggering other script), and an excellent api. It is nicer from the web interface and a lot more clear. If I would have to set 120 unique update scripts, it becomes more unmanageble fast…and working from a single screen is nice.

Hadouken (opensource, very lightweight torrent client), does these realy smart things (launcher and deployment): http://docs.hdkn.net/en/latest/configuration/automove.html http://docs.hdkn.net/en/latest/configuration/launcher.html

Resilio (wich I think is not cool, has it as well) https://www.resilio.com/connect4/images/0003_scripts.png?crc=4077226475

This will allow also regular people to use this, that don’t take the time to use the api. And it has been requested a lot!

Feature request: Is it possible to include update script path, either in config.xml or in the gui (gui is more friendly).

I think your first request could be satisfied with new folders being auto added/created when announced by an introducer, in a default directory somewhere. This is probably happening at some point.

Can you explain the second a bit more? I don’t get the thing with 120 different scripts, and the example looks like you’d configure the scripts on some device A and they would then be executed on another device B?

1 Like

Briljant, however we need the software to arrive to certain nodes…only On the server, creating a folder, include a couple of nodes and start syncing… If none of the nodes/remote devices/endpoints require any action and per default accept the folders, this is good Is this already implemented?

The machinery that is created is semi-special…this means a lot of different scripts…specific binaries for Plcs (siemens, allain bradly, sigmatec) and other electronics, updated in st, weird c/c++, ld, you name it… (In windows embedded…linux) It would be cool if syncthing could trigger a script…or a command without us requiring to write a piece inside every single piece of software that looks if syncthing is finished downloading…

No, not implemented but discussed here and there.

I hear you on the scripts, but what I would consider possible is to have something that is configured, on the device itself, to be run when new files appear. Not something that is configured from somewhere else. I’m not sure if this is what you’re looking for or not.

Your suggestion (on feature suggestion 1) would make a great feature though!! espessially for devices left unattended servers, nodes, NAS!

With regard to question 2, In effect this is the same, since syncthing first writes temporary files…then copies it in place…(according to your spec; https://docs.syncthing.net/users/syncing.html)…

https://github.com/hadouken/hadouken/blob/9ff98fe713e741f4cc588058952121b68f618376/js/plugins/automove.js ( and launcher.js, putting the link between " makes it not show snippets, this is done on purpose)

It is controlled like this from a json (like your config.xml)

{
  "extensions":
  {
    "launcher":
    {
      "enabled": true,
      "apps":
      [
        [ "torrent.added", "C:/Apps/some-app.bat" ]
      ]
    }
  }
}

And here is how they do this…

function getRules() { var values = config.get(“extensions.automove.rules”); var result = []; for(var i = 0; i < values.length; i++) { var path = values[i].path; var filter = values[i].filter;

    if(filter === "pattern") {
        var pattern = values[i].data.pattern;
        var field   = values[i].data.field;

        result.push(new Rule(path, new PatternFilter(new RegExp(pattern), field)));
    } else if(filter === "tags") {
        result.push(new Rule(path, new TagsFilter(values[i].data)));
    } else if(filter === "label") {
        result.push(new Rule(path, new LabelFilter(values[i].data)));
    }
}

return result;

}

They do it rather smart! Go is a bit outside my spectrum, and you probably want it in there, rather than javascript.

cmd := exec.Command("ls", "/foo/bar")
var waitStatus syscall.WaitStatus
if err := cmd.Run(); err != nil {
  if err != nil {
    os.Stderr.WriteString(fmt.Sprintf("Error: %s\n", err.Error()))
  }
  if exitError, ok := err.(*exec.ExitError); ok {
    waitStatus = exitError.Sys().(syscall.WaitStatus)
    fmt.Printf("Output: %s\n", []byte(fmt.Sprintf("%d", waitStatus.ExitStatus())))
  }
} else {
  // Success
  waitStatus = cmd.ProcessState.Sys().(syscall.WaitStatus)
  fmt.Printf("Output: %s\n", []byte(fmt.Sprintf("%d", waitStatus.ExitStatus())))
}