2
# Copyright (c) 2004 Author: Thorsten Kukuk <kukuk@suse.de>
6
# and symbolic its link
10
# System startup script for the ypbind daemon
14
# Required-Start: $remote_fs $portmap
15
# Should-Start: ypserv slpd
16
# Required-Stop: portmap
18
# Default-Stop: 0 1 2 6
19
# Short-Description: Start ypbind (necessary for a NIS client)
20
# Description: ypbind finds the server for NIS domains and maintains
21
# the NIS binding information.
24
YPBIND_BIN=/usr/sbin/ypbind
25
test -x $YPBIND_BIN || { echo "$YPBIND_BIN not installed";
26
if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; }
28
YPBIND_CONFIG=/etc/sysconfig/ypbind
29
test -r $YPBIND_CONFIG || { echo "$YPBIND_CONFIG not existing";
30
if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; }
37
# First reset status of this service
40
# Return values acc. to LSB for all commands but status:
43
# 2 - invalid or excess args
44
# 3 - unimplemented feature (e.g. reload)
45
# 4 - insufficient privilege
46
# 5 - program not installed
47
# 6 - program not configured
49
# Note that starting an already running service, stopping
50
# or restarting a not-running service as well as the restart
51
# with force-reload (in case signalling is not supported) are
52
# considered a success.
56
echo -n "Starting ypbind"
57
## If the domainname is not set, skip starting of ypbind
58
## and return with "program not configured"
59
/bin/ypdomainname &> /dev/null
60
if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; then
61
if [ -f /etc/defaultdomain ]; then
62
XDOMAINNAME=`cat /etc/defaultdomain`
63
/bin/ypdomainname "$XDOMAINNAME"
65
/bin/ypdomainname &> /dev/null
66
if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; then
67
# Tell the user this has skipped
68
echo -n " . . . . . . . . . . No domainname set"
70
# service is not configured
76
## If we don't have a /etc/yp.conf file, skip starting of
77
## ypbind and return with "program not configured"
78
## if you add the -broadcast Option later, comment this out.
79
if [ ! -f /etc/yp.conf -a "$YPBIND_BROADCAST" != "yes" ] ; then
80
# Tell the user this has skipped
81
echo -n " . . . . . . . . . . ${attn}/etc/yp.conf not found${norm}"
83
# service is not configured
88
## Check if portmap is running, else abort with error
89
checkproc /sbin/portmap
91
echo -n " . . . . . . . . . . ${attn}No portmapper running${norm}"
97
# evaluate the OPTIONS for ypbind-mt
99
test "$YPBIND_LOCAL_ONLY" = "yes" && OPTIONS="-local-only $OPTIONS"
100
test "$YPBIND_BROADCAST" = "yes" && OPTIONS="-broadcast $OPTIONS"
101
test "$YPBIND_BROKEN_SERVER" = "yes" && OPTIONS="-broken-server $OPTIONS"
103
startproc $YPBIND_BIN $YPBIND_OPTIONS $OPTIONS
104
if [ $? -eq 0 ]; then
106
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
107
ypwhich &>/dev/null && { notfound=0 ; break; };
111
if [ $notfound -eq 1 ]; then
112
echo -n " ${warn}No NIS server found${norm}";
120
echo -n "Shutting down ypbind"
121
killproc -TERM $YPBIND_BIN
122
# Remove static data, else glibc will continue to use NIS
123
rm -f /var/yp/binding/* /var/run/ypbind.pid
126
try-restart|condrestart)
127
## Do a restart only if the service was active before.
128
## Note: try-restart is now part of LSB (as of 1.9).
129
## RH has a similar command named condrestart.
130
if test "$1" = "condrestart"; then
131
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
137
rc_reset # Not running is not a failure.
148
echo -n "Reload service ypbind"
149
killproc -HUP $YPBIND_BIN
153
echo -n "Reload service ypbind"
154
killproc -HUP $YPBIND_BIN
158
echo -n "Checking for ypbind: "
159
checkproc $YPBIND_BIN
163
if [ /etc/yp.conf -nt /var/run/ypbind.pid ]; then
165
elif [ $YPBIND_CONFIG -nt /var/run/ypbind.pid ]; then
170
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"