Add tsp/jobs/watch_sdb.sh 46/108746/3
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 13 Dec 2016 09:19:19 +0000 (10:19 +0100)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 1 Feb 2017 16:36:51 +0000 (17:36 +0100)
Change-Id: Id49dc135dac374701a75e90aeea4093999c5a896
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tsp/cronfile.example
tsp/jobs/watch_sdb.sh [new file with mode: 0755]

index 42c8794..f2146ba 100644 (file)
@@ -1,2 +1,3 @@
 */10 * * * * /opt/testlab-major/tsp/jobs/watcher.sh
 0 */4 * * * /opt/testlab-major/tsp/jobs/watch_diskspace.sh
+0 * * * * /opt/testlab-major/tsp/jobs/watch_sdb.sh
diff --git a/tsp/jobs/watch_sdb.sh b/tsp/jobs/watch_sdb.sh
new file mode 100755 (executable)
index 0000000..27eb814
--- /dev/null
@@ -0,0 +1,32 @@
+#!/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>
+
+# make sure the server is running
+timeout 120 sdb start-server
+
+# check if it works
+SDB="$(timeout 120 sdb devices)"
+SDB_RET="$?"
+
+if [ "${SDB_RET}" -eq 0 ]; then
+    echo $(date) ok >> /tmp/sdb.log
+else
+    echo $(date) restart >> /tmp/sdb.log
+    killall sdb
+    sdb start-server
+fi