"Fossies" - the Fresh Open Source Software Archive 
Member "freeha-1.0/service_scripts/fs.start" (23 Nov 2006, 1889 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 mount a filesystem #
5 # Primarily useful for when you have a filesytem on a shared disk #
6 # Provided as a tool to be called from 'starthasrv' #
7 # #
8 # USAGE: fs.start device mountpoint fstype fsck-dev [optional mountargs] #
9 # EG: #
10 # fs.start /dev/md/metaset/dsk/d12 /export/home ufs /dev/md/metaset/rdsk/d12 #
11 # #
12 # Standard UNIX status: returns 0 on okay, non-0 on fail. #
13 #----------------------------------------------------------------------------#
14
15
16
17 #This is tweaked for Solaris, because that's what I have to play with.
18 # Please submit whatever tweaks are neccessary for your favorite OS.
19
20 PATH=$PATH:/usr/sbin:/sbin
21
22 if [ $# -lt 3 ] ; then
23 echo fs.start: ERROR: Need to specify device path, mount point, and fstype
24 echo fs.start: optionally add fsck device as fourth argument.
25 exit 1
26 fi
27
28
29 fs.monitor $1 $2 >/dev/null
30 if [ $? -eq 0 ] ; then
31 echo fs.start: filesystem $2 already mounted
32 exit 0
33 fi
34
35 if [ "$5" != "" ] ; then
36 MOUNTARGS="$5"
37 fi
38
39 mount -F $3 $MOUNTARGS $1 $2
40 if [ $? -eq 0 ] ; then exit 0 ; fi
41
42 # Problem. can we fix it?
43 # First, check if things are valid.
44
45 if [ ! -d $2 ] ; then
46 echo fs.start: ERROR: mountpoint $2 does not exist
47 exit 1
48 fi
49
50 if [ ! -b $1 ] ; then
51 echo fs.start: ERROR: device $1 does not exist
52 exit 1
53 fi
54
55 if [ "$4" != "" ] ; then
56 fsck -F $3 -y $4
57 mount -F $3 $MOUNTARGS $1 $2
58 else
59 echo ERROR: cannot mount $1 on $2. Needs 'fsck?'
60 exit 1
61 fi
62
63 # if mount errors again, error should fall through as exit status.
64