|
Line 0
Link Here
|
|
|
1 |
#!/bin/sh |
| 2 |
@%@UCRWARNING=# @%@ |
| 3 |
# |
| 4 |
# start/stop rpcbind daemon. |
| 5 |
|
| 6 |
### BEGIN INIT INFO |
| 7 |
# Provides: rpcbind |
| 8 |
# Required-Start: $network $local_fs |
| 9 |
# Required-Stop: $network $local_fs |
| 10 |
# Default-Start: S 2 3 4 5 |
| 11 |
# Default-Stop: 0 1 6 |
| 12 |
# Short-Description: RPC portmapper replacement |
| 13 |
# Description: rpcbind is a server that converts RPC (Remote |
| 14 |
# Procedure Call) program numbers into DARPA |
| 15 |
# protocol port numbers. It must be running in |
| 16 |
# order to make RPC calls. Services that use |
| 17 |
# RPC include NFS and NIS. |
| 18 |
### END INIT INFO |
| 19 |
|
| 20 |
test -f /sbin/rpcbind || exit 0 |
| 21 |
|
| 22 |
. /lib/lsb/init-functions |
| 23 |
|
| 24 |
OPTIONS="-w" |
| 25 |
STATEDIR=/run/rpcbind |
| 26 |
PIDFILE=/run/rpcbind.pid |
| 27 |
|
| 28 |
if [ -f /etc/default/rpcbind ] |
| 29 |
then |
| 30 |
. /etc/default/rpcbind |
| 31 |
elif [ -f /etc/rpcbind.conf ] |
| 32 |
then |
| 33 |
. /etc/rpcbind.conf |
| 34 |
fi |
| 35 |
|
| 36 |
start () |
| 37 |
{ |
| 38 |
# check ucr autostart setting |
| 39 |
if [ -f "/usr/share/univention-config-registry/init-autostart.lib" ]; then |
| 40 |
. "/usr/share/univention-config-registry/init-autostart.lib" |
| 41 |
check_autostart rpcbind rpcbind/autostart |
| 42 |
fi |
| 43 |
if [ ! -d $STATEDIR ] ; then |
| 44 |
mkdir $STATEDIR |
| 45 |
fi |
| 46 |
if [ ! -O $STATEDIR ] ; then |
| 47 |
log_begin_msg "$STATEDIR not owned by root" |
| 48 |
log_end_msg 1 |
| 49 |
exit 1 |
| 50 |
fi |
| 51 |
if [ ! -f $STATEDIR/rpcbind.xdr ] |
| 52 |
then |
| 53 |
touch $STATEDIR/rpcbind.xdr |
| 54 |
fi |
| 55 |
if [ ! -f $STATEDIR/portmap.xdr ] |
| 56 |
then |
| 57 |
touch $STATEDIR/portmap.xdr |
| 58 |
fi |
| 59 |
[ -x /sbin/restorecon ] && /sbin/restorecon $STATEDIR/*.xdr |
| 60 |
log_begin_msg "Starting rpcbind daemon..." |
| 61 |
pid=$( pidofproc /sbin/rpcbind ) |
| 62 |
if [ -n "$pid" ] |
| 63 |
then |
| 64 |
log_begin_msg "Already running." |
| 65 |
log_end_msg 0 |
| 66 |
exit 0 |
| 67 |
fi |
| 68 |
start-stop-daemon --start --quiet --oknodo --exec /sbin/rpcbind -- "$@" |
| 69 |
pid=$( pidofproc /sbin/rpcbind ) |
| 70 |
echo -n "$pid" >"$PIDFILE" |
| 71 |
# /run/sendsigs.omit.d is created by /etc/init.d/mountkernfs.sh |
| 72 |
ln -sf "$PIDFILE" /run/sendsigs.omit.d/rpcbind |
| 73 |
log_end_msg $? |
| 74 |
|
| 75 |
} |
| 76 |
|
| 77 |
stop () |
| 78 |
{ |
| 79 |
log_begin_msg "Stopping rpcbind daemon..." |
| 80 |
start-stop-daemon --stop --quiet --oknodo --exec /sbin/rpcbind |
| 81 |
rm -f "$PIDFILE" |
| 82 |
log_end_msg $? |
| 83 |
} |
| 84 |
|
| 85 |
case "$1" in |
| 86 |
start) |
| 87 |
start $OPTIONS |
| 88 |
;; |
| 89 |
stop) |
| 90 |
stop |
| 91 |
;; |
| 92 |
restart|force-reload) |
| 93 |
stop |
| 94 |
start $OPTIONS |
| 95 |
;; |
| 96 |
status) |
| 97 |
status_of_proc /sbin/rpcbind rpcbind && exit 0 || exit $? |
| 98 |
;; |
| 99 |
*) |
| 100 |
log_success_msg "Usage: /etc/init.d/rpcbind {start|stop|force-reload|restart|status}" |
| 101 |
exit 1 |
| 102 |
;; |
| 103 |
esac |
| 104 |
|
| 105 |
exit 0 |