Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
daily-scripts
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
daily-scripts
Commits
bffa9f22
There was an error fetching the commit references. Please try again later.
Commit
bffa9f22
authored
1 month ago
by
Recolic
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
73624e8e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
linuxconf/utils/auto-nfs-mgr.sh
+27
-9
27 additions, 9 deletions
linuxconf/utils/auto-nfs-mgr.sh
with
27 additions
and
9 deletions
linuxconf/utils/auto-nfs-mgr.sh
+
27
−
9
View file @
bffa9f22
...
@@ -16,25 +16,43 @@ check_reachability() {
...
@@ -16,25 +16,43 @@ check_reachability() {
return
$HMS_BAD
# Host is unreachable
return
$HMS_BAD
# Host is unreachable
fi
fi
}
}
check_mounted
()
{
df
-T
|
grep
nfs
&&
return
$HMS_GOOD
||
return
$HMS_BAD
}
prev_stat
=
$HMS_GOOD
#
prev_stat=$HMS_GOOD
while
true
;
do
while
true
;
do
check_reachability
check_reachability
stat
=
$?
net_stat
=
$?
if
[
$stat
!=
$prev_stat
]
;
then
check_mounted
nfs_stat
=
$?
if
[
$net_stat
!=
$nfs_stat
]
;
then
# Two more double-confirmation. If difference fixed, do not update prev_stat and continue.
# Two more double-confirmation. If difference fixed, do not update prev_stat and continue.
sleep
1
;
check_reachability
;
[
$?
=
$
prev
_stat
]
&&
continue
sleep
1
;
check_reachability
;
[
$?
=
$
nfs
_stat
]
&&
continue
sleep
1
;
check_reachability
;
[
$?
=
$
prev
_stat
]
&&
continue
sleep
1
;
check_reachability
;
[
$?
=
$
nfs
_stat
]
&&
continue
echo
"
$(
date
)
State
change from
$prev_stat
to
$
stat
"
echo
"
$(
date
)
State
mismatch detected, network
$net_stat
but nfs
$nfs_
stat
"
# If still doesn't match prev_stat, do something.
if
[
$net_stat
=
$HMS_BAD
]
;
then
if
[
$stat
=
$HMS_BAD
]
;
then
umount
-f
-l
/home/recolic/nfs
umount
-f
-l
/home/recolic/nfs
else
else
mount
-o
bg
,intr,soft,timeo
=
1,retrans
=
1,actimeo
=
1,retry
=
1 hms.r:/ /home/recolic/nfs
mount
-o
bg
,intr,soft,timeo
=
1,retrans
=
1,actimeo
=
1,retry
=
1 hms.r:/ /home/recolic/nfs
fi
fi
fi
fi
prev_stat
=
$stat
# if [ $stat != $prev_stat ]; then
# # Two more double-confirmation. If difference fixed, do not update prev_stat and continue.
# sleep 1 ; check_reachability ; [ $? = $prev_stat ] && continue
# sleep 1 ; check_reachability ; [ $? = $prev_stat ] && continue
# echo "$(date) State change from $prev_stat to $stat"
#
# # If still doesn't match prev_stat, do something.
# if [ $stat = $HMS_BAD ]; then
# umount -f -l /home/recolic/nfs
# else
# mount -o bg,intr,soft,timeo=1,retrans=1,actimeo=1,retry=1 hms.r:/ /home/recolic/nfs
# fi
# fi
# prev_stat=$stat
sleep
3
# Sleep for 3 seconds
sleep
3
# Sleep for 3 seconds
done
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment