aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2017-12-13 13:17:15 +0100
committerAnders Roxell <anders.roxell@linaro.org>2017-12-16 12:48:55 +0100
commit3acb268064ebfdb4574dfceeab965b1308d5b99a (patch)
tree7da5977240eba7acd7c260ed5f1e1df83e11252a
parent94a87146ec8a806965cc683fa44ddb13f21a92db (diff)
invoke_session_oe: simplify ELAPSED time calculationHEADmaster
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rwxr-xr-xinvoke_session_oe9
1 files changed, 5 insertions, 4 deletions
diff --git a/invoke_session_oe b/invoke_session_oe
index 2a41049..48f953b 100755
--- a/invoke_session_oe
+++ b/invoke_session_oe
@@ -47,9 +47,10 @@ EOF
mkdir -p /run
mkdir -p /run/hacking
echo $$ > /run/hacking/hacking.pid
-TIMESTAMP=`stat -c %Y /run/hacking/hacking.pid`
STARTED=false
TERMINATED=false
+ELAPSED=0
+TIME_TO_SLEEP=10
echo "Hacking session active..."
lava-test-case hacking-session-active --result pass
tail -f /var/log/syslog &
@@ -61,13 +62,13 @@ do
who
echo "===================="
echo ""
- sleep 10
+ sleep `echo $TIME_TO_SLEEP`
LOGGEDIN=`who | grep pts | wc -l`
if ! $STARTED && [ $LOGGEDIN -gt 0 ]; then
STARTED=true
elif ! $STARTED && [ $LOGGEDIN -eq 0 ]; then
- NOW=`date +%s`
- ELAPSED=`expr $NOW - $TIMESTAMP`
+
+ ELAPSED=`expr $ELAPSED + $TIME_TO_SLEEP`
if [ $ELAPSED -gt 3600 ]; then
TERMINATED=true
echo "No user logged in. Terminating session..."