Quote:
Originally Posted by
graysky
1) Check to see if the mount is active
For this you could use 'grep'. But not for output, just the exit value (meaing "$?"). Check /proc/mounts. Mount a directory. Check /proc/mounts again. Try to grep the mounted partition line from /proc/mounts.
Quote:
Originally Posted by
graysky
2) If it's not active, try to mount it
You know the mount command, right? So if the previous 'grep' fails you could use the exit value as cue to mount it. To test the mount bit you could use a command that always outputs exit value 1: 'false'. Test it with 'false || echo doSomething; false && echo doSomethingElse'. You'll see.
Quote:
Originally Posted by
graysky
3) If it won't mount because the nfs server is down, wait 45 s then try again looping indefinitely until the nfs server is up
"Wait" here means 'sleep'. Try 'man sleep' to find out how to use it. Again you can use a "negative" (in shell) exit value.
Quote:
Originally Posted by
graysky
4) Once the mount is active, run a program and exit
Same here: use the exit value.
Here's some Bash scripting guides that will help you glue those things together if you like:
BASH Programming - Introduction HOW-TO,
Bash Guide for Beginners,
Advanced Bash-Scripting Guide.
Once you have something to test out, posting it in code tags would make things easier in case things went awry somewhere.