summaryrefslogtreecommitdiff
path: root/tsp/jobs
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-05-06 11:29:57 +0200
committerAleksander Mistewicz <a.mistewicz@samsung.com>2016-07-04 14:36:04 +0200
commit728babb2e82b0f73365e1ac0f69440717f5d673a (patch)
treeb4d6678d6ced316b97abe1f3e9a65d2e9347a2fc /tsp/jobs
parent76ebf187a46341dcde24205033dd8052f0a3809b (diff)
downloadmajor-728babb2e82b0f73365e1ac0f69440717f5d673a.tar.gz
major-728babb2e82b0f73365e1ac0f69440717f5d673a.tar.bz2
major-728babb2e82b0f73365e1ac0f69440717f5d673a.zip
Add tsp/jobs/watch_diskspace.sh
Change-Id: Ifeaf25b5a4b06ef7ee19704ac42c682fb4fe96a3 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp/jobs')
-rwxr-xr-xtsp/jobs/watch_diskspace.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/tsp/jobs/watch_diskspace.sh b/tsp/jobs/watch_diskspace.sh
new file mode 100755
index 0000000..296015e
--- /dev/null
+++ b/tsp/jobs/watch_diskspace.sh
@@ -0,0 +1,33 @@
+#!/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"
+
+# Assume workspaces are stored on root partition.
+# Get diskspace usage for root mountpoint.
+PER=`df -Ph | grep -o "[0-9][0-9]%.*/$"`
+# Leave only numerical value.
+PER=${PER%\%*}
+if [ "$PER" -ge 70 ]
+then
+ nr=$(tsmaster -L DISK_CLEANUP sh "${TSP_DIR}/scripts/free_diskspace.sh")
+ # make the above job urgent
+ tsmaster -u "$nr"
+fi