summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2017-09-19 09:11:44 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-09-27 16:58:34 (GMT)
commit922da6fc08194d13e7ca4d67ecda08f180688736 (patch)
treeb9a6d111424cd3eee6d1851266731b7ef376f964
parent3b1340c04711e5cf4d5f10fd484bb8104c036083 (diff)
downloadmajor-922da6fc08194d13e7ca4d67ecda08f180688736.zip
major-922da6fc08194d13e7ca4d67ecda08f180688736.tar.gz
major-922da6fc08194d13e7ca4d67ecda08f180688736.tar.bz2
Adjust number of preserved prerelease imagesrefs/changes/32/181832/1
Change-Id: I0447ebca5da49a625cfbe2c8b8eb83dcbb97629e
-rwxr-xr-xtsp/jobs/free_diskspace.sh9
-rwxr-xr-xtsp/watchers/watch_diskspace.sh19
2 files changed, 22 insertions, 6 deletions
diff --git a/tsp/jobs/free_diskspace.sh b/tsp/jobs/free_diskspace.sh
index efdcd1f..b7af05b 100755
--- a/tsp/jobs/free_diskspace.sh
+++ b/tsp/jobs/free_diskspace.sh
@@ -17,13 +17,18 @@
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
# Assume that most of the space is taken up by downloaded images.
-# Delete ones that were modified at least 2 days ago.
+# Delete ones that were modified at least MTIME+1 days ago.
export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
-for i in $(find "${WS_DOWNLOAD}" -maxdepth 1 -mindepth 1 -type d -mtime +1)
+MTIME="$1"
+
+# if argument is missing assign default value.
+test -n "$MTIME" || MTIME="6"
+
+for i in $(find "${WS_DOWNLOAD}" -maxdepth 1 -mindepth 1 -type d -mtime "+$MTIME")
do
for diff_file in $(find "$i" -type f -name diff.report)
do
diff --git a/tsp/watchers/watch_diskspace.sh b/tsp/watchers/watch_diskspace.sh
index 9fd2e54..9fbe67d 100755
--- a/tsp/watchers/watch_diskspace.sh
+++ b/tsp/watchers/watch_diskspace.sh
@@ -24,9 +24,20 @@ export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
PER="$(df -P "${WS_DOWNLOAD}" | grep -o "[0-9]\+%.*$")"
# Leave only numerical value.
PER="${PER%\%*}"
-if [ "$PER" -ge 30 ]
+
+if [ "$PER" -ge 80 ]
then
- nr="$(tsmaster -L DISK_CLEANUP sh "${TSP_DIR}/jobs/free_diskspace.sh")"
- # make the above job urgent
- tsmaster -u "$nr"
+ nr="$(tsmaster -L DISK_CLEANUP sh "${TSP_DIR}/jobs/free_diskspace.sh" 1)"
+else
+ if [ "$PER" -ge 60 ]
+ then
+ nr="$(tsmaster -L DISK_CLEANUP sh "${TSP_DIR}/jobs/free_diskspace.sh" 3)"
+ else
+ if [ "$PER" -ge 40 ]
+ then
+ nr="$(tsmaster -L DISK_CLEANUP sh "${TSP_DIR}/jobs/free_diskspace.sh" 7)"
+ fi
+ fi
fi
+
+test -z "$nr" || tsmaster -u "$nr"