"Fossies" - the Fresh Open Source Software Archive 
Member "freeha-1.0/service_scripts/fs.monitor" (23 Nov 2006, 1763 Bytes) of package /linux/privat/old/freeha-1.0.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/bin/sh
2
3 #-------------------------------------------------------------------------#
4 # Script to monitor that a particular filesystem stays mounted #
5 # Primarily useful for when you have a filesytem on a shared disk #
6 # Provided as a tool to be called from 'monitorhasrv' #
7 # #
8 # USAGE: fs.monitor devpath mountpoint #
9 # EG: fs.monitor /dev/md/metaset/dsk/d12 /export/home #
10 # #
11 # Standard UNIX status: returns 0 on okay, non-0 on fail. #
12 #-------------------------------------------------------------------------#
13
14
15
16 # This is tweaked for Solaris, because that's what I have to play with.
17 # Please submit whatever tweaks are neccessary for your favorite OS.
18
19
20 PATH=$PATH:/usr/sbin:/sbin
21
22 if [ $# -ne 2 ] ; then
23 echo fs.monitor: ERROR: Need to specify device path, and filesystem mount point
24 exit 1
25 fi
26
27
28 df $2 | egrep '(^|[(])'$1 >/dev/null
29 if [ $? -eq 0 ] ; then
30 # Doublecheck filesystem is actualy FUNCTIONING
31 # This will hang, if Solaris disksuite finds disks unavailable
32 # Which will then cause a timeout of heartbeats, which will
33 # then cause the other node to forcibly take over.
34 # In Solaris, this will result in panicing this machine
35 ls -d $2/. >/dev/null
36
37 # Success!
38 exit 0
39 fi
40
41 # Something's wrong. Try to figure out a little more about WHAT is wrong
42
43 if [ ! -d $2 ] ; then
44 echo fs.monitor: ERROR: mountpoint $2 does not exist
45 exit 1
46 fi
47
48 if [ ! -b $1 ] ; then
49 echo fs.monitor: ERROR: device $1 does not exist
50 exit 1
51 fi
52
53 echo fs.monitor: $1 does not appear to be mounted on $2
54 exit 2
55