1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#!/bin/sh
#
# /etc/init.d/nis Start NIS (formerly YP) daemons.
#
### BEGIN INIT INFO
# Provides: ypbind
# Required-Start: $network $portmap $remote_fs ypserv
# Required-Stop: $portmap $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start NIS client and server daemons.
# Description: Start NIS client and server daemons. NIS is mostly
# used to let several machines in a network share the
# same account information (eg the password file).
### END INIT INFO
# Customize the variables in /etc/default/nis rather than here
NISSERVER=false
NISMASTER=
YPPWDDIR=/etc
YPCHANGEOK=chsh
YPSERVARGS=""
YPBINDARGS=""
YPPASSWDDARGS=""
YPXFRDARGS=""
YPPWDDIRARGS=""
[ -f /etc/default/nis ] && . /etc/default/nis
. /lib/lsb/init-functions
NET="/usr/sbin"
test -f ${NET}/ypbind -a -f /etc/defaultdomain || exit 0
do_start ()
{
oname=`domainname`
nname=`cat /etc/defaultdomain`
if [ "$oname" != "$nname" ]; then
log_action_msg "Setting NIS domainname to: $nname"
domainname "$nname"
fi
log_daemon_msg "Starting NIS services"
log_progress_msg "ypbind"
start-stop-daemon -b --start --quiet \
--exec ${NET}/ypbind -- $broadcast ${YPBINDARGS}
log_end_msg 0
}
do_stop () {
log_daemon_msg "Stopping NIS services"
log_progress_msg "ypbind"
start-stop-daemon --stop --quiet --oknodo \
--pidfile /var/run/ypbind.pid
log_end_msg 0
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
reload|force-reload)
start-stop-daemon --stop --quiet --oknodo --signal 1 \
--pidfile /run/ypbind.pid --exec ${NET}/ypbind
;;
restart)
do_stop
sleep 2
do_start
;;
*)
echo "Usage: /etc/init.d/nis {start|stop|reload|force-reload|restart}"
exit 1
esac
exit 0
|