ypserv/ypserv-ypxfrd.init

116 lines
1.9 KiB
Plaintext
Raw Normal View History

2010-01-21 18:12:03 +00:00
#!/bin/sh
#
# 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.
# 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
. /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
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
}
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}"
}
# See how we were called.
case "$1" in
2010-01-21 18:12:03 +00:00
start)
rh_status_q && exit 0
$1
;;
2010-01-21 18:12:03 +00:00
stop)
rh_status_q || exit 0
$1
;;
2010-01-21 18:12:03 +00:00
restart)
$1
;;
2010-01-21 18:12:03 +00:00
reload)
rh_status_q || exit 7
$1
;;
2010-01-21 18:12:03 +00:00
force-reload)
force_reload
;;
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
esac
2010-01-21 18:12:03 +00:00
exit $?