- ctx.Log.Infof("Syncthing-inotify started (PID %d)", ctx.SThgInotCmd.Process.Pid)
-
- // Establish connection with local Syncthing (retry if connection fail)
- time.Sleep(3 * time.Second)
- retry := 10
- for retry > 0 {
- if err := ctx.SThg.Connect(); err == nil {
- break
- }
- ctx.Log.Infof("Establishing connection to Syncthing (retry %d/5)", retry)
- time.Sleep(time.Second)
- retry--
- }
- if ctx.SThg == nil {
- err = fmt.Errorf("ERROR: cannot connect to Syncthing (url: %s)", ctx.SThg.BaseURL)
- return cli.NewExitError(err, 2)
- }
-
- // Retrieve Syncthing config
- id, err := ctx.SThg.IDGet()
- if err != nil {
- return cli.NewExitError(err, 2)
- }
- ctx.Log.Infof("Local Syncthing ID: %s", id)