From 9eab536c147b1d8e23ef07628158d08c6fd4d783 Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Wed, 18 Jul 2018 14:42:00 -0700 Subject: [PATCH] fix kill command --- aws-experiment-launch/experiment/commander/main.go | 9 ++++++--- aws-experiment-launch/experiment/soldier/main.go | 2 +- aws-experiment-launch/new-pipeline/userdata-soldier.sh | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/aws-experiment-launch/experiment/commander/main.go b/aws-experiment-launch/experiment/commander/main.go index 0fd5566f3..aa67daeb4 100644 --- a/aws-experiment-launch/experiment/commander/main.go +++ b/aws-experiment-launch/experiment/commander/main.go @@ -126,9 +126,12 @@ func dictateNode(addr string, command string) int { // read response buff := make([]byte, 1024) - n, _ := conn.Read(buff) - log.Printf("Receive from %s: %s", addr, buff[:n]) - return 1 + if n, err := conn.Read(buff); err == nil { + log.Printf("Receive from %s: %s", addr, buff[:n]) + return 1 + } else { + return 0 + } } func handleUploadRequest(w http.ResponseWriter, r *http.Request) { diff --git a/aws-experiment-launch/experiment/soldier/main.go b/aws-experiment-launch/experiment/soldier/main.go index fd1210465..cc6e8b8b6 100644 --- a/aws-experiment-launch/experiment/soldier/main.go +++ b/aws-experiment-launch/experiment/soldier/main.go @@ -150,7 +150,7 @@ func handleInitCommand(args []string, w *bufio.Writer) { func handleKillCommand(w *bufio.Writer) { log.Println("Kill command") - runCmd("../kill_node.sh") + runCmd("./kill_node.sh") logAndReply(w, "Kill command done.") } diff --git a/aws-experiment-launch/new-pipeline/userdata-soldier.sh b/aws-experiment-launch/new-pipeline/userdata-soldier.sh index 6c4633723..1c3cef2aa 100644 --- a/aws-experiment-launch/new-pipeline/userdata-soldier.sh +++ b/aws-experiment-launch/new-pipeline/userdata-soldier.sh @@ -5,10 +5,12 @@ curl http://unique-bucket-bin.s3.amazonaws.com/txgen -o txgen curl http://unique-bucket-bin.s3.amazonaws.com/soldier -o soldier curl http://unique-bucket-bin.s3.amazonaws.com/commander -o commander curl http://unique-bucket-bin.s3.amazonaws.com/benchmark -o benchmark +curl http://unique-bucket-bin.s3.amazonaws.com/kill_node.sh -o kill_node.sh chmod +x ./soldier chmod +x ./txgen chmod +x ./benchmark chmod +x ./commander +chmod +x ./kill_node.sh # Get My IP ip=`curl http://169.254.169.254/latest/meta-data/public-ipv4`