rpcbind/rpcbind.init

85 lines
1.8 KiB
Bash

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: portmap rpcbind
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Short-Description: TI-RPC program number mapper
# Description: TI-RPC program number mapper
### END INIT INFO
#
RPCBIND_BIN=/sbin/rpcbind
test -x $RPCBIND_BIN || { echo "$RPCBIND_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
. /etc/sysconfig/rpcbind
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting rpcbind "
/sbin/startproc $RPCBIND_BIN $OPTIONS $RPCBIND_OPTIONS
rc_status -v
;;
stop)
echo -n "Shutting down rpcbind "
/sbin/killproc -TERM $RPCBIND_BIN
rc_status -v
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
# do a warmstart in this case, keeping the state
OPTIONS="-w" $0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
rc_status
;;
force-reload)
$0 try-restart
rc_status
;;
reload)
# rpcbind does not support reload on signal
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for service rpcbind "
/sbin/checkproc $RPCBIND_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
;;
esac
rc_exit