1 | #!/bin/bash |
---|
2 | # |
---|
3 | # GPFS configuration (SLES only) |
---|
4 | # |
---|
5 | # /etc/init.d/gpfs |
---|
6 | # |
---|
7 | ### BEGIN INIT INFO |
---|
8 | # Provides: gpfs |
---|
9 | # Required-Start: $local_fs $network portmap |
---|
10 | # Should-Start: |
---|
11 | # Required-Stop: |
---|
12 | # Should-Stop: |
---|
13 | # Default-Start: 2 3 5 |
---|
14 | # Default-Stop: |
---|
15 | # Description: Configure the GPFS environment and optionally mount filesystems |
---|
16 | ### END INIT INFO |
---|
17 | |
---|
18 | . /etc/rc.status |
---|
19 | |
---|
20 | rc_reset |
---|
21 | |
---|
22 | if [ ! -f /var/mmfs/etc/nfsdefs ]; then |
---|
23 | echo "$0: Can't find NFS defines (nfsdefs) in /var/mmfs/etc. Terminating." |
---|
24 | exit 0 |
---|
25 | fi |
---|
26 | if [ ! -f /var/mmfs/etc/nfsfuncs ]; then |
---|
27 | echo "$0: Can't find NFS functions (nfsfuncs) in /var/mmfs/etc. Terminating." |
---|
28 | exit 0 |
---|
29 | fi |
---|
30 | . /var/mmfs/etc/nfsdefs |
---|
31 | . /var/mmfs/etc/nfsfuncs |
---|
32 | |
---|
33 | start() { |
---|
34 | # We need to do the following before starting GPFS: |
---|
35 | # 1. Start ssh (or rsh) because we may need to communicate with other nodes |
---|
36 | # if this is a node failback |
---|
37 | # 2. Don't start NFS before GPFS because it causes nfsd restart |
---|
38 | # to fail in restart of lockd |
---|
39 | # 3. Configure NLM ports here so a subsequent start of nfsd will get the |
---|
40 | # correct ports assigned |
---|
41 | # 4. Cleanup any stale files left over on reboot |
---|
42 | |
---|
43 | if [ -f $NODELIST.shutdown ]; then |
---|
44 | if [ ! -f $NODELIST ]; then |
---|
45 | mv $NODELIST.shutdown $NODELIST |
---|
46 | else |
---|
47 | rm $NODELIST.shutdown |
---|
48 | fi |
---|
49 | fi |
---|
50 | startRshd |
---|
51 | configNLMPorts $(myGPFSIP) |
---|
52 | if [ $? -ne 0 ]; then |
---|
53 | echo "$0: cannot configure NLM ports for HA-NFS. NLM failover may not function correctly." |
---|
54 | fi |
---|
55 | |
---|
56 | if [ -e /usr/lpp/mmfs/bin/mmautoload ]; then |
---|
57 | /usr/lpp/mmfs/bin/mmautoload |
---|
58 | fi |
---|
59 | } |
---|
60 | |
---|
61 | stop() { |
---|
62 | if [ -e /usr/lpp/mmfs/bin/mmshutdown ]; then |
---|
63 | /var/mmfs/etc/nfsmonitor -e |
---|
64 | /usr/lpp/mmfs/bin/mmshutdown |
---|
65 | /var/mmfs/etc/cleanup |
---|
66 | fi |
---|
67 | } |
---|
68 | |
---|
69 | case "$1" in |
---|
70 | start) |
---|
71 | echo -n "Starting GPFS " |
---|
72 | start |
---|
73 | rc_status -v |
---|
74 | ;; |
---|
75 | stop) |
---|
76 | echo -n "Stopping GPFS " |
---|
77 | stop |
---|
78 | rc_status -v |
---|
79 | ;; |
---|
80 | shutdown) |
---|
81 | echo -n "Stopping GPFS (no failover) " |
---|
82 | [ -f $NODELIST ] && mv $NODELIST $NODELIST.shutdown |
---|
83 | stop |
---|
84 | rc_status -v |
---|
85 | [ -f $NODELIST.shutdown ] && mv $NODELIST.shutdown $NODELIST |
---|
86 | ;; |
---|
87 | restart|try-restart) |
---|
88 | echo -n "Restarting GPFS " |
---|
89 | [ -f $NODELIST ] && mv $NODELIST $NODELIST.shutdown |
---|
90 | stop |
---|
91 | [ -f $NODELIST.shutdown ] && mv $NODELIST.shutdown $NODELIST |
---|
92 | start |
---|
93 | rc_status -v |
---|
94 | ;; |
---|
95 | status) |
---|
96 | rc_failed 4 |
---|
97 | rc_status -v |
---|
98 | ;; |
---|
99 | reload|force-reload) |
---|
100 | # Currently, this only restarts the monitor |
---|
101 | if [ -e /var/mmfs/etc/nfsmonitor ]; then |
---|
102 | echo -n "Restarting monitor " |
---|
103 | /var/mmfs/etc/nfsmonitor restart |
---|
104 | fi |
---|
105 | rc_status -v |
---|
106 | ;; |
---|
107 | *) |
---|
108 | echo "Usage: $0 {start|stop|shutdown|restart|try-restart|reload|force-reload|status}" |
---|
109 | exit 1 |
---|
110 | esac |
---|
111 | rc_exit |
---|