Commit | Line | Data |
---|---|---|
805e021f CE |
1 | #!/sbin/sh |
2 | # Copyright 2000, International Business Machines Corporation and others. | |
3 | # All Rights Reserved. | |
4 | # | |
5 | # This software has been released under the terms of the IBM Public | |
6 | # License. For details, see the LICENSE file in the top-level source | |
7 | # directory or online at http://www.openafs.org/dl/license10.html | |
8 | ||
9 | # afs.rc: rc script for AFS on HP-UX 10 platforms | |
10 | # | |
11 | # Install this script as /sbin/init.d/afs | |
12 | # then make links like this: | |
13 | # ln -s /sbin/init.d/afs /sbin/rc2.d/K800afs | |
14 | # ln -s /sbin/init.d/afs /sbin/rc2.d/S460afs | |
15 | # | |
16 | CONFIG=/usr/vice/etc/config | |
17 | AFSDOPT=$CONFIG/afsd.options | |
18 | PACKAGE=$CONFIG/package.options | |
19 | ||
20 | LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128" | |
21 | MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70" | |
22 | SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50" | |
23 | ||
24 | if [ -f $AFSDOPT ]; then | |
25 | OPTIONS=`cat $AFSDOPT` | |
26 | else | |
27 | OPTIONS=$MEDIUM | |
28 | fi | |
29 | ||
30 | # Need the commands ps, awk, kill, sleep, as | |
31 | PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin:/opt/dce/bin:/usr/ccs/bin | |
32 | ||
33 | killproc() { # kill the named process(es) | |
34 | fpid='$2' | |
35 | fproc='$8' | |
36 | pid=`ps -ef | \ | |
37 | awk "$fproc == \"$1\" || $fproc ~ /.*\/$1/ { print $fpid }"` | |
38 | [ "$pid" != "" ] && kill -KILL $pid | |
39 | } | |
40 | ||
41 | case $1 in | |
42 | start_msg) | |
43 | echo "Start AFS subsystem" | |
44 | ;; | |
45 | ||
46 | stop_msg) | |
47 | echo "Stop AFS server subsystem" | |
48 | ;; | |
49 | ||
50 | 'start') | |
51 | ||
52 | # | |
53 | # Start the AFS server processes if a bosserver exists | |
54 | # | |
55 | ||
56 | if [ -x /usr/afs/bin/bosserver ]; then | |
57 | echo "Starting AFS Server processes" | |
58 | /usr/afs/bin/bosserver | |
59 | OPTIONS="$OPTIONS -nosettime" | |
60 | sleep 30 | |
61 | fi | |
62 | ||
63 | # | |
64 | # Check that all of the client configuration files exist | |
65 | # | |
66 | ||
67 | for file in /usr/vice/etc/afsd /usr/vice/etc/cacheinfo \ | |
68 | /usr/vice/etc/ThisCell /usr/vice/etc/CellServDB | |
69 | do | |
70 | if [ ! -f ${file} ]; then | |
71 | echo "${file} does not exist. Not starting AFS client." | |
72 | exit 1 | |
73 | fi | |
74 | done | |
75 | ||
76 | # | |
77 | # Check that the root directory for AFS (/afs) | |
78 | # and the cache directory (/usr/vice/cache) both exist | |
79 | # | |
80 | ||
81 | for dir in `awk -F: '{print $1, $2}' /usr/vice/etc/cacheinfo` | |
82 | do | |
83 | if [ ! -d ${dir} ]; then | |
84 | echo "${dir} does not exist. Not starting AFS client." | |
85 | exit 2 | |
86 | fi | |
87 | done | |
88 | ||
89 | echo "Starting afsd" | |
90 | /usr/vice/etc/afsd $OPTIONS | |
91 | ||
92 | # | |
93 | # Run package to update the disk | |
94 | # | |
95 | if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then | |
96 | /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1 | |
97 | case $? in | |
98 | 0) | |
99 | (echo "Package completed successfully") > /dev/console 2>&1 | |
100 | date > /dev/console 2>&1 | |
101 | ;; | |
102 | 4) | |
103 | (echo "Rebooting to restart system") > /dev/console 2>&1 | |
104 | sync | |
105 | /etc/reboot | |
106 | ;; | |
107 | *) | |
108 | (echo "Package update failed; continuing") > /dev/console 2>&1 | |
109 | ;; | |
110 | esac | |
111 | ||
112 | fi | |
113 | ||
114 | # | |
115 | # Start AFS inetd services | |
116 | # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs) | |
117 | # | |
118 | if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then | |
119 | /usr/sbin/inetd.afs /etc/inetd.conf.afs | |
120 | fi | |
121 | ||
122 | ||
123 | echo ;; | |
124 | ||
125 | 'stop') | |
126 | ||
127 | # | |
128 | # Stop the server processes and inetd | |
129 | # Note that the afsd processes cannot be killed | |
130 | # | |
131 | echo "Killing inetd.afs" | |
132 | killproc inetd.afs | |
133 | ||
134 | bosrunning=`ps -ef | awk '/bosserver/ && ! /awk/ && ! /dcebos/'` | |
135 | if [ "${bosrunning}" != "" ]; then | |
136 | echo "Shutting down AFS server processes" | |
137 | /usr/afs/bin/bos shutdown localhost -localauth -wait | |
138 | echo "Killing AFS bosserver" | |
139 | killproc "\/usr\/afs\/bin\/bosserver" | |
140 | fi | |
141 | ||
142 | echo ;; | |
143 | ||
144 | *) echo "Invalid option supplied to $0" | |
145 | exit 1;; | |
146 | esac |