dba551a518
Fix below linters errors E010 The "do" should be on same line as for E010 The "do" should be on same line as while E011 Then keyword is not on same line as if or elif keyword E020 Function declaration not in format ^function name {$ Ignore: E041 Arithmetic expansion using $[ is deprecated for $(( E042 local declaration hides errors E043 Arithmetic compound has inconsistent return semantics E044 Use [[ for non-POSIX comparisions Story: 2003366 Task: 24423 Change-Id: I8b6b72e702d3e89d1813772d6bf16819e28e818c Signed-off-by: Martin Chen <haochuan.z.chen@intel.com>
49 lines
1.1 KiB
Bash
49 lines
1.1 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
|
|
# The following script tests the NFS mount in order to log when it is hung
|
|
|
|
MOUNT=/opt/platform
|
|
previous=1
|
|
delay=60
|
|
|
|
while : ; do
|
|
# First, check that it's actually an NFS mount
|
|
mount | grep -q $MOUNT
|
|
if [ $? -ne 0 ]; then
|
|
logger -t NFSCHECK "$MOUNT is not mounted"
|
|
previous=1
|
|
sleep $delay
|
|
continue
|
|
fi
|
|
|
|
ls $MOUNT >/dev/null 2>&1 &
|
|
|
|
sleep $delay
|
|
|
|
# At this point, jobs will either report no jobs (empty) or Done,
|
|
# unless the job is still running/hung
|
|
rc=$(jobs)
|
|
if [[ -z "$rc" || $rc =~ "Done" ]]; then
|
|
# NFS is successful
|
|
if [ $previous -ne 0 ]; then
|
|
logger -t NFSCHECK "NFS test of $MOUNT is ok"
|
|
previous=0
|
|
fi
|
|
else
|
|
# Keep waiting until the job is done
|
|
while ! [[ -z "$rc" || $rc =~ "Done" ]]; do
|
|
logger -t NFSCHECK "NFS test of $MOUNT is failed"
|
|
previous=1
|
|
sleep $delay
|
|
rc=$(jobs)
|
|
done
|
|
fi
|
|
done
|
|
|