1 | #!/sbin/sh |
---|
2 | # |
---|
3 | # Copyright (c) 1997-1999 by Sun Microsystems, Inc. |
---|
4 | # All rights reserved. |
---|
5 | # |
---|
6 | #ident "@(#)rpc 1.40 99/02/03 SMI" |
---|
7 | |
---|
8 | [ ! -d /usr/bin ] && exit |
---|
9 | |
---|
10 | case "$1" in |
---|
11 | 'start'|'rpcstart') |
---|
12 | if [ "$1" = start ]; then |
---|
13 | if [ -z "$_INIT_PREV_LEVEL" ]; then |
---|
14 | set -- `/usr/bin/who -r` |
---|
15 | _INIT_PREV_LEVEL="$9" |
---|
16 | fi |
---|
17 | |
---|
18 | if [ $_INIT_PREV_LEVEL != S -a $_INIT_PREV_LEVEL != 1 \ |
---|
19 | -a $_INIT_PREV_LEVEL != '?' ]; then |
---|
20 | exit 0 |
---|
21 | fi |
---|
22 | |
---|
23 | [ -x /usr/sbin/rpcbind ] || exit 0 |
---|
24 | fi |
---|
25 | |
---|
26 | echo "starting rpc services:\c" |
---|
27 | /usr/bin/mkdir -p -m 1777 /tmp/.rpc_door |
---|
28 | /usr/sbin/rpcbind >/dev/msglog 2>&1 |
---|
29 | echo " rpcbind\c" |
---|
30 | |
---|
31 | # Configure NIS or NIS+ |
---|
32 | |
---|
33 | if [ -f /etc/.UNCONFIGURED -a -x /usr/sbin/sysidnis ]; then |
---|
34 | /usr/sbin/sysidnis >/dev/msglog 2>&1 |
---|
35 | fi |
---|
36 | |
---|
37 | # Start NIS+. Note this needs to be done after keyserv |
---|
38 | # has started because NIS+ uses the keyserver for authentication. |
---|
39 | |
---|
40 | if [ -d /var/nis -a -x /usr/sbin/rpc.nisd ]; then |
---|
41 | if [ -f /var/nis/NIS_COLD_START ]; then |
---|
42 | if [ -x /usr/sbin/nis_cachemgr ]; then |
---|
43 | /usr/sbin/nis_cachemgr |
---|
44 | echo " nis_cachemgr\c" |
---|
45 | fi |
---|
46 | fi |
---|
47 | |
---|
48 | # Uncomment the following line setting EMULYP if you want |
---|
49 | # rpc.nisd to emulate the NIS (YP) service |
---|
50 | |
---|
51 | #EMULYP="-Y" |
---|
52 | |
---|
53 | # We always start the NIS+ Password Update Daemon. If it |
---|
54 | # finds the NIS+ server is not a Master it will just exit. |
---|
55 | # It also determines if the server is running in NIS (YP) |
---|
56 | # compat mode and automatically registers a yppasswdd so NIS |
---|
57 | # (YP) clients can change their passwords. |
---|
58 | |
---|
59 | [ -z "$_INIT_UTS_NODENAME" ] && \ |
---|
60 | _INIT_UTS_NODENAME=`/usr/bin/uname -n` |
---|
61 | |
---|
62 | hostname=`echo "$_INIT_UTS_NODENAME" | /usr/bin/cut -d. -f1 | \ |
---|
63 | /usr/bin/tr '[A-Z]' '[a-z]'` |
---|
64 | |
---|
65 | if [ -d /var/nis/data -o -d /var/nis/$hostname ]; then |
---|
66 | /usr/sbin/rpc.nisd $EMULYP |
---|
67 | echo " rpc.nisd \c" |
---|
68 | /usr/sbin/rpc.nispasswdd |
---|
69 | fi |
---|
70 | fi |
---|
71 | |
---|
72 | # Start NIS (YP) services. The ypstart script handles both client |
---|
73 | # and server startup, whichever is appropriate. |
---|
74 | |
---|
75 | if [ -x /usr/lib/netsvc/yp/ypstart ]; then |
---|
76 | /usr/lib/netsvc/yp/ypstart rpcstart |
---|
77 | fi |
---|
78 | |
---|
79 | echo " done." |
---|
80 | ;; |
---|
81 | |
---|
82 | 'stop') |
---|
83 | # Bring all of the RPC service daemons to a halt. Note that the |
---|
84 | # daemons are stopped in a particular order. Further note that rpcbind |
---|
85 | # is special in that it needs to be killed with -9 to prevent it from |
---|
86 | # saving its state and sending a message to syslog. |
---|
87 | |
---|
88 | for daemon in rpc.nisd nis_cachemgr keyserv rpc.nispasswdd; do |
---|
89 | /usr/bin/pkill -x -u 0 $daemon |
---|
90 | done |
---|
91 | |
---|
92 | if [ -x /usr/lib/netsvc/yp/ypstop ]; then |
---|
93 | /usr/lib/netsvc/yp/ypstop |
---|
94 | fi |
---|
95 | |
---|
96 | /usr/bin/pkill -9 -x -u 0 rpcbind |
---|
97 | /usr/bin/rm -rf /tmp/.rpc_door |
---|
98 | ;; |
---|
99 | |
---|
100 | *) |
---|
101 | echo "Usage: $0 { rpcstart | start | stop }" |
---|
102 | exit 1 |
---|
103 | ;; |
---|
104 | esac |
---|
105 | exit 0 |
---|