2004-09-09 15:13:27 +00:00
|
|
|
#!/bin/bash
|
2004-09-09 15:13:01 +00:00
|
|
|
#
|
|
|
|
# ypserv: Starts the yp-server
|
|
|
|
#
|
|
|
|
# Version: @(#) /etc/init.d/ypserv.init 1.0
|
|
|
|
#
|
|
|
|
# Author: Joerg Mertin <smurphy@stargate.bln.sub.org>
|
|
|
|
#
|
2004-09-09 15:13:27 +00:00
|
|
|
# chkconfig: - 26 74
|
2004-09-09 15:13:01 +00:00
|
|
|
# description: ypserv is an implementation of the standard NIS/YP networking \
|
|
|
|
# protocol. It allows network-wide distribution of hostname, \
|
|
|
|
# username, and other information databases. This is the NIS \
|
|
|
|
# server, and is not needed on NIS clients.
|
|
|
|
# processname: ypserv
|
|
|
|
# config: /etc/ypserv.conf
|
|
|
|
|
|
|
|
# Source function library.
|
2004-09-09 15:13:27 +00:00
|
|
|
[ -f /etc/rc.d/init.d/functions ] || exit 0
|
|
|
|
. /etc/rc.d/init.d/functions
|
2004-09-09 15:13:01 +00:00
|
|
|
|
|
|
|
# getting the YP-Domainname
|
|
|
|
. /etc/sysconfig/network
|
|
|
|
|
|
|
|
RETVAL=0
|
|
|
|
|
|
|
|
start() {
|
2004-09-09 15:14:37 +00:00
|
|
|
DOMAINNAME=`domainname`
|
|
|
|
if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
|
|
|
|
if [ -n "$NISDOMAIN" ]; then
|
|
|
|
action $"Setting NIS domain name $NISDOMAIN: " domainname $NISDOMAIN
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2004-09-09 15:13:27 +00:00
|
|
|
echo -n $"Starting YP server services: "
|
2004-09-09 15:14:21 +00:00
|
|
|
daemon ypserv $YPSERV_ARGS
|
2004-09-09 15:13:01 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ypserv
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2004-09-09 15:13:27 +00:00
|
|
|
echo -n $"Stopping YP server services: "
|
2004-09-09 15:13:01 +00:00
|
|
|
killproc ypserv
|
|
|
|
RETVAL=$?
|
|
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ypserv
|
|
|
|
echo
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status ypserv
|
2007-09-15 17:36:54 +00:00
|
|
|
RETVAL=$?
|
2004-09-09 15:13:01 +00:00
|
|
|
;;
|
2004-09-09 15:15:29 +00:00
|
|
|
restart|reload)
|
2004-09-09 15:13:01 +00:00
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
condrestart)
|
|
|
|
if [ -f /var/lock/subsys/ypserv ]; then
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
2004-09-09 15:14:18 +00:00
|
|
|
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
|
2004-09-09 15:13:01 +00:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|