summaryrefslogtreecommitdiffstats
path: root/lib/syncthing/st.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syncthing/st.go')
-rw-r--r--lib/syncthing/st.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go
index 99a17a1..d1ebbe6 100644
--- a/lib/syncthing/st.go
+++ b/lib/syncthing/st.go
@@ -34,16 +34,16 @@ type SyncThing struct {
STICmd *exec.Cmd
MyID string
Connected bool
+ Events *Events
// Private fields
binDir string
logsDir string
exitSTChan chan ExitChan
exitSTIChan chan ExitChan
- conf *xdsconfig.Config
client *common.HTTPClient
log *logrus.Logger
- Events *Events
+ conf *xdsconfig.Config
}
// ExitChan Channel used for process exit
@@ -134,7 +134,8 @@ func (s *SyncThing) startProc(exeName string, args []string, env []string, eChan
// Kill existing process (useful for debug ;-) )
if os.Getenv("DEBUG_MODE") != "" {
- exec.Command("bash", "-c", "pkill -9 "+exeName).Output()
+ fmt.Printf("\n!!! DEBUG_MODE set: KILL existing %s process(es) !!!\n", exeName)
+ exec.Command("bash", "-c", "ps -ax |grep "+exeName+" |grep "+s.BaseURL+" |cut -d' ' -f 1|xargs -I{} kill -9 {}").Output()
}
// When not set (or set to '.') set bin to path of xds-agent executable
@@ -227,7 +228,6 @@ func (s *SyncThing) Start() (*exec.Cmd, error) {
env := []string{
"STNODEFAULTFOLDER=1",
"STNOUPGRADE=1",
- "STNORESTART=1", // FIXME SEB remove ?
}
s.STCmd, err = s.startProc("syncthing", args, env, &s.exitSTChan)
@@ -317,7 +317,12 @@ func (s *SyncThing) Connect() error {
common.HTTPClientConfig{
URLPrefix: "/rest",
HeaderClientKeyName: "X-Syncthing-ID",
+ LogOut: s.conf.LogVerboseOut,
+ LogPrefix: "SYNCTHING: ",
+ LogLevel: common.HTTPLogLevelWarning,
})
+ s.client.SetLogLevel(s.log.Level.String())
+
if err != nil {
msg := ": " + err.Error()
if strings.Contains(err.Error(), "connection refused") {
@@ -329,11 +334,6 @@ func (s *SyncThing) Connect() error {
return fmt.Errorf("ERROR: cannot connect to Syncthing (null client)")
}
- // Redirect HTTP log into a file
- s.client.SetLogLevel(s.conf.Log.Level.String())
- s.client.LoggerPrefix = "SYNCTHING: "
- s.client.LoggerOut = s.conf.LogVerboseOut
-
s.MyID, err = s.IDGet()
if err != nil {
return fmt.Errorf("ERROR: cannot retrieve ID")