summaryrefslogtreecommitdiff
path: root/tsp/stop.sh
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-07-26 12:45:20 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2016-12-06 15:37:13 (GMT)
commit25470c9f2dde4a249f83afc218a07ca02455fbd5 (patch)
tree8b55765d44d9d62092e736f14c844f3e16dc6747 /tsp/stop.sh
parentac4018f7b85469e378985351d1d7e88e8a9e7a68 (diff)
downloadmajor-25470c9f2dde4a249f83afc218a07ca02455fbd5.zip
major-25470c9f2dde4a249f83afc218a07ca02455fbd5.tar.gz
major-25470c9f2dde4a249f83afc218a07ca02455fbd5.tar.bz2
To stop TITS run: ./tsp/stop.sh Steps are: * remove crontab * save currently dispatched urls * for tsmaster, tspoll, tspwb: ** remove queued jobs ** kill running jobs ** kill the server * for tsrun_target queues: ** remove queued jobs ** wait for running jobs ** kill the server To start TITS run: crontab tsp/cronfile.example Change-Id: I051a9ddcec0093c1fae3888ec9a9b438b73f5bb3 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp/stop.sh')
-rwxr-xr-xtsp/stop.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/tsp/stop.sh b/tsp/stop.sh
new file mode 100755
index 0000000..77e727b
--- /dev/null
+++ b/tsp/stop.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
+
+export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)"
+
+. "${TSP_DIR}/common.sh"
+
+echo "Remove crontab"
+crontab -r
+
+kill_running() {
+ echo "[$@] Kill every running job"
+ for i in $(eval $@ | grep "running" | grep -o "^[0-9]*")
+ do
+ kill `eval $@ -p $i`
+ done
+}
+
+remove_queued() {
+ echo "[$@] Remove every queued job"
+ for i in $(eval $@ | grep "queued" | grep -o "^[0-9]*")
+ do
+ eval $@ -r $i
+ done
+}
+
+echo "Save dispatched SRs"
+
+tsmaster | grep "running\|queued" | grep -o "http://.*/" | sort -u >> "${WS_WATCHER}/manual_urls"
+
+echo "Stop master queues"
+
+for queue in "tsmaster" "tspoll" "tspwb"
+do
+ remove_queued $queue
+ kill_running $queue
+ echo "[$queue] Kill server"
+ eval $queue -K
+done
+
+echo "Stop runner queues"
+echo "Queued tests will be lost"
+
+for target in "odroid" "minnow32" "minnow64"
+do
+ remove_queued tsrun_target $target
+done
+
+echo "Wait for last tests to finish and kill server"
+
+for target in "odroid" "minnow32" "minnow64"
+do
+ echo "[$target] wait for running job"
+ tsrun_target $target -w
+ echo "[$target] Kill server"
+ tsrun_target $target -K
+done