2010-01-21 18:12:03 +00:00
|
|
|
#!/bin/sh
|
2004-09-09 15:14:21 +00:00
|
|
|
#
|
|
|
|
# ypxfrd: Starts the ypxfrd daemon
|
|
|
|
#
|
|
|
|
# Version: @(#) /etc/init.d/ypxfrd 1.0
|
|
|
|
#
|
|
|
|
# chkconfig: - 26 74
|
|
|
|
# description: ypxfrd should be started in addition to ypserv to accelerate \
|
|
|
|
# transferring yp maps.
|
|
|
|
# processname: ypxfrd
|
2010-01-21 18:12:03 +00:00
|
|
|
#
|
|
|
|
# See https://fedoraproject.org/wiki/Packaging:SysVInitScript for
|
|
|
|
# the guidelines document.
|
2004-09-09 15:14:21 +00:00
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
[ -f /etc/rc.d/init.d/functions ] || exit 0
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
|
2010-01-21 18:12:03 +00:00
|
|
|
# getting the YP domain name
|
2004-09-09 15:14:21 +00:00
|
|
|
. /etc/sysconfig/network
|
|
|
|
|
2010-01-21 18:12:03 +00:00
|
|
|
execname="rpc.ypxfrd"
|
|
|
|
exec="/usr/sbin/$execname"
|
|
|
|
prog="ypxfrd"
|
|
|
|
|
|
|
|
lockfile=/var/lock/subsys/$prog
|
|
|
|
pidfile=/var/run/$prog.pid
|
2004-09-09 15:14:21 +00:00
|
|
|
|
|
|
|
start() {
|
2010-01-21 18:12:03 +00:00
|
|
|
[ $UID -eq 0 ] || exit 4
|
|
|
|
[ -x $exec ] || exit 5
|
|
|
|
echo -n $"Starting YP map server: "
|
|
|
|
daemon --pidfile=$pidfile $exec $YPXFRD_ARGS
|
|
|
|
retval=$?
|
|
|
|
echo
|
|
|
|
[ $retval -eq 0 ] && touch $lockfile
|
|
|
|
return $retval
|
2004-09-09 15:14:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2010-01-21 18:12:03 +00:00
|
|
|
[ $UID -eq 0 ] || exit 4
|
|
|
|
[ -x $exec ] || exit 5
|
|
|
|
echo -n $"Stopping YP map server: "
|
|
|
|
killproc -p $pidfile $execname
|
|
|
|
retval=$?
|
|
|
|
echo
|
|
|
|
[ $retval -eq 0 ] && rm -f $lockfile
|
|
|
|
return $retval
|
|
|
|
}
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
reload() {
|
|
|
|
echo -n $"Reloading securenets and ypserv.conf file:"
|
|
|
|
killproc -p $pidfile $execname -HUP
|
|
|
|
retval=$?
|
|
|
|
echo
|
|
|
|
return $retval
|
|
|
|
}
|
|
|
|
|
|
|
|
force_reload() {
|
|
|
|
restart
|
|
|
|
}
|
|
|
|
|
|
|
|
rh_status() {
|
|
|
|
# run checks to determine if the service is running or use generic status
|
|
|
|
status -p $pidfile -l $prog $execname
|
|
|
|
}
|
|
|
|
|
|
|
|
rh_status_q() {
|
|
|
|
rh_status >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
2004-09-09 15:14:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
2010-01-21 18:12:03 +00:00
|
|
|
start)
|
|
|
|
rh_status_q && exit 0
|
|
|
|
$1
|
2004-09-09 15:14:21 +00:00
|
|
|
;;
|
2010-01-21 18:12:03 +00:00
|
|
|
stop)
|
|
|
|
rh_status_q || exit 0
|
|
|
|
$1
|
2004-09-09 15:14:21 +00:00
|
|
|
;;
|
2010-01-21 18:12:03 +00:00
|
|
|
restart)
|
|
|
|
$1
|
2004-09-09 15:14:21 +00:00
|
|
|
;;
|
2010-01-21 18:12:03 +00:00
|
|
|
reload)
|
|
|
|
rh_status_q || exit 7
|
|
|
|
$1
|
2004-09-09 15:14:21 +00:00
|
|
|
;;
|
2010-01-21 18:12:03 +00:00
|
|
|
force-reload)
|
|
|
|
force_reload
|
2004-09-09 15:14:21 +00:00
|
|
|
;;
|
2010-01-21 18:12:03 +00:00
|
|
|
status)
|
|
|
|
rh_status
|
|
|
|
;;
|
|
|
|
condrestart|try-restart)
|
|
|
|
rh_status_q || exit 0
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
usage)
|
|
|
|
$1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
exit 2
|
2004-09-09 15:14:21 +00:00
|
|
|
esac
|
2010-01-21 18:12:03 +00:00
|
|
|
exit $?
|