- fmt.Printf("Syncthing-inotify started (PID %d)\n", ctx.SThgInotCmd.Process.Pid)
-
- // Establish connection with local Syncthing (retry if connection fail)
- time.Sleep(3 * time.Second)
- maxRetry := 30
- retry := maxRetry
- for retry > 0 {
- if err := ctx.SThg.Connect(); err == nil {
- break
- }
- ctx.Log.Infof("Establishing connection to Syncthing (retry %d/%d)", retry, maxRetry)
- time.Sleep(time.Second)
- retry--
- }
- if err != nil || retry == 0 {
- 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)