]> git.pld-linux.org Git - packages/ocfs2-tools.git/blame - ocfs2.init
- release 2
[packages/ocfs2-tools.git] / ocfs2.init
CommitLineData
bebea8a1 1#!/bin/sh
c566897e 2# Copyright (c) 2005 Oracle
3# All rights reserved.
4#
bebea8a1 5# chkconfig: 2345 25 19
6# description: Mount OCFS2 volumes at boot.
c566897e 7#
c566897e 8
bebea8a1 9# Source function library
10. /etc/rc.d/init.d/functions
c566897e 11
bebea8a1 12# Get network config
13. /etc/sysconfig/network
14
15# Get service config
16[ -f /etc/sysconfig/ocfs2 ] && . /etc/sysconfig/ocfs2
17
18# Check that networking is up.
19if is_yes "${NETWORKING}"; then
20 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
21 msg_network_down OCFS2
22 exit 1
23 fi
24else
25 exit 0
26fi
c566897e 27
28success_status()
29{
30 success
31 echo
32}
33
34failure_status()
35{
36 failure $1
37 echo
38}
39
c566897e 40ocfs2mounts()
41{
42 LC_ALL=C awk '$3 == "ocfs2" { print $2 }' /proc/mounts
43}
44
45ocfs2fstab()
46{
47 LC_ALL=C awk '!/^#/ && $3 == "ocfs2" && $4 !~ /noauto/ { print $2 }' /etc/fstab
48}
49
bebea8a1 50RETVAL=0
c566897e 51
52case "$1" in
53 start|reload)
bebea8a1 54 if [ ! -f /var/lock/subsys/ocfs2 ]; then
55 if [ -n "`ocfs2fstab`" ] ; then
56 run_cmd "Mounting OCFS2 filesystems" mount -a -t ocfs2
57 touch /var/lock/subsys/ocfs2
58 fi
59 else
60 msg_already_running "OCFS2 filesystems"
61 fi
c566897e 62 ;;
63 stop)
bebea8a1 64 show "Oracle Cluster File System (OCFS2) "
65 busy
c566897e 66 remaining="`ocfs2mounts`"
67 sig=
68 retry=3
69 while [ -n "$remaining" -a "$retry" -gt 0 ]
70 do
71 if [ "$retry" -lt 3 ]; then
72 echo -n "Retry stopping Oracle Cluster File System (OCFS2) "
73 fi
bebea8a1 74 umount -a -t ocfs2 > /dev/null 2>&1
c566897e 75 sleep 1
76
77 remaining="`ocfs2mounts`"
78 [ -z "$remaining" ] && break
79 failure_status "Unable to unmount OCFS2 filesystems"
80
bebea8a1 81 /sbin/fuser -k -m $sig $remaining
c566897e 82 sleep 5
83 retry=$(($retry - 1))
84 sig=-9
85 done
bebea8a1 86 [ -z "$remaining" ] && ok
12031430 87 rm -f /var/lock/subsys/ocfs2
c566897e 88 ;;
89 restart|force-reload)
90 $0 stop
91 $0 start
92 ;;
93 status)
94 if [ -f /proc/mounts ] ; then
95 [ -n "`ocfs2fstab`" ] && {
96 echo "Configured OCFS2 mountpoints: " `ocfs2fstab`
97 }
98
99 [ -n "`ocfs2mounts`" ] && {
100 echo "Active OCFS2 mountpoints: " `ocfs2mounts`
101 }
102 else
103 echo -n "Checking OCFS2 mountpoints: "
104 failure_status
105 fi
106 ;;
107 try-restart|condrestart)
108 $0 status
109 if test $? = 0; then
110 $0 restart
111 fi
112 ;;
113 *)
bebea8a1 114 msg_usage "$0 {start|stop|status|reload|force-reload|restart|try-restart}"
115 exit 3
c566897e 116esac
117
bebea8a1 118exit $RETVAL
This page took 0.065388 seconds and 4 git commands to generate.