summaryrefslogtreecommitdiffstats
path: root/lib/syncthing/st.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-07 23:10:38 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-06 15:57:04 +0100
commita3d2ca72d05d28b1ae5820787ff696dd75fd17cc (patch)
tree295cc649918cb886e7b742a3be64174b88c6a26e /lib/syncthing/st.go
parent1b9336d459474c76dc806757e7ddf49edfd65a33 (diff)
Kill right Syncthing (same url) in DEBUG mode
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/syncthing/st.go')
-rw-r--r--lib/syncthing/st.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go
index b14f40d..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