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