summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2017-05-24 08:30:33 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-06-06 11:48:03 (GMT)
commitea2b7fe522811c5a8b35ed0a321905fb14a380d3 (patch)
tree86c732229092b835ff8c9cee7cfbf20601f28a8c
parente98831f4d156d46967368af91f8f6c66cec457ca (diff)
downloadmajor-ea2b7fe522811c5a8b35ed0a321905fb14a380d3.zip
major-ea2b7fe522811c5a8b35ed0a321905fb14a380d3.tar.gz
major-ea2b7fe522811c5a8b35ed0a321905fb14a380d3.tar.bz2
Remove download directories of killed jobsrefs/changes/33/130933/2
Change-Id: I6f1d19e8b3c4ab07a8d0c41489a0bc79b063913e
-rwxr-xr-xtsp/jobs/trigger_downloads.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/tsp/jobs/trigger_downloads.sh b/tsp/jobs/trigger_downloads.sh
index d765e4a..db3e3a0 100755
--- a/tsp/jobs/trigger_downloads.sh
+++ b/tsp/jobs/trigger_downloads.sh
@@ -69,8 +69,18 @@ while read -r url
do
test -n "${url}" || continue
echo "Processing: ${url}"
+ # check if a job is already queued
+ test -z $(tsmaster | awk -v URL="$url" '$2 ~ "queued" && $0 ~ URL {print $1}') || {
+ echo "URL has been already queued"
+ continue
+ }
# kill currently running jobs for this url
- for i in $(tsmaster | awk -v URL="$url" '$2 ~ "running" && $0 ~ URL {print $1}'); do kill "$(tsmaster -p "$i")"; done
+ for running in $(tsmaster | awk -v URL="$url" '$2 ~ "running" && $0 ~ URL {print $1}')
+ do
+ NR=$(tsmaster | grep "$running" | grep -o "\[[0-9]*\]" | grep -o "[0-9]*")
+ kill "$(tsmaster -p "$running")"
+ test -z "$NR" || rm -rv "${WS_DOWNLOAD}/${NR}"
+ done
next=$((next+1))
dwn_next="${next}"
# prepare download directory