c671507
#! /bin/sh
c671507
#
c671507
# rpcbind       Start/Stop RPCbind
c671507
#
6c2c090
# chkconfig: 2345 13 87
c671507
# description: The rpcbind utility is a server that converts RPC program \
c671507
#              numbers into universal addresses. It must be running on the \
c671507
#              host to be able to make RPC calls on a server on that machine.
c671507
#
c671507
# processname: rpcbind
c671507
# probe: true
e9338cb
# config: /etc/sysconfig/rpcbind
c671507
c671507
c671507
# This is an interactive program, we need the current locale
c671507
[ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh
c671507
# We can't Japanese on normal console at boot time, so force LANG=C.
c671507
if [ "$LANG" = "ja" -o "$LANG" = "ja_JP.eucJP" ]; then
c671507
    if [ "$TERM" = "linux" ] ; then
c671507
        LANG=C
c671507
    fi
c671507
fi
c671507
c671507
# Source function library.
c671507
. /etc/init.d/functions
c671507
940cb45
# Source networking configuration.
940cb45
[ -f /etc/sysconfig/network ] &&  . /etc/sysconfig/network
c671507
c671507
prog="rpcbind"
c671507
[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
c671507
c671507
RETVAL=0
940cb45
uid=`id | cut -d\( -f1 | cut -d= -f2`
c671507
c671507
start() {
970296b
	# Check that networking is up.
33dfe4f
	[ "$NETWORKING" = "yes" ] || exit 6
940cb45
970296b
	[ -f /sbin/$prog ] || exit 5
970296b
940cb45
	# Make sure the rpcbind is not already running.
940cb45
	if status $prog > /dev/null ; then
940cb45
		exit 0	
940cb45
	fi
940cb45
940cb45
	# Only root can start the service
940cb45
	[ $uid -ne 0 ] && exit 4
940cb45
970296b
	echo -n $"Starting $prog: "
604a14b
	daemon $prog $RPCBIND_ARGS $1
970296b
	RETVAL=$?
970296b
	echo
970296b
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
c671507
	return $RETVAL
c671507
}
c671507
c671507
c671507
stop() {
970296b
	echo -n $"Stopping $prog: "
970296b
	killproc $prog
970296b
	RETVAL=$?
970296b
	echo
970296b
	[ $RETVAL -eq 0 ] && {
970296b
		rm -f /var/lock/subsys/$prog
970296b
		rm -f /var/run/rpcbind*
970296b
	}
c671507
	return $RETVAL
c671507
}
c671507
c671507
# See how we were called.
c671507
case "$1" in
c671507
  start)
c671507
	start
c671507
	;;
c671507
  stop)
c671507
	stop
c671507
	;;
c671507
  status)
c671507
	status $prog
390a5c7
	RETVAL=$?
c671507
	;;
940cb45
  restart | reload| force-reload)
940cb45
	$0 stop
940cb45
	$0 start
940cb45
	RETVAL=$?
c671507
	;;
940cb45
  condrestart | try-restart)
a9ce663
	if [ -f /var/lock/subsys/$prog ]; then
940cb45
		$0 stop
940cb45
		$0 start -w
940cb45
		RETVAL=$?
a9ce663
	fi
c671507
	;;
c671507
  *)
940cb45
	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}"
940cb45
	RETVAL=2
940cb45
	;;
c671507
esac
c671507
940cb45
exit $RETVAL