Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # start/stop rpcbind daemon. |
| 4 | |
| 5 | ### BEGIN INIT INFO |
| 6 | # Provides: rpcbind |
| 7 | # Required-Start: $network |
| 8 | # Required-Stop: $network |
| 9 | # Default-Start: S 2 3 4 5 |
| 10 | # Default-Stop: 0 1 6 |
| 11 | # Short-Description: RPC portmapper replacement |
| 12 | # Description: rpcbind is a server that converts RPC (Remote |
| 13 | # Procedure Call) program numbers into DARPA |
| 14 | # protocol port numbers. It must be running in |
| 15 | # order to make RPC calls. Services that use |
| 16 | # RPC include NFS and NIS. |
| 17 | ### END INIT INFO |
| 18 | |
| 19 | # Source function library. |
| 20 | . /etc/init.d/functions |
| 21 | |
| 22 | test -f /sbin/rpcbind || exit 0 |
| 23 | |
| 24 | OPTIONS="" |
| 25 | if [ -f /etc/default/rpcbind ] |
| 26 | then |
| 27 | . /etc/default/rpcbind |
| 28 | elif [ -f /etc/rpcbind.conf ] |
| 29 | then |
| 30 | . /etc/rpcbind.conf |
| 31 | fi |
| 32 | |
| 33 | start () |
| 34 | { |
| 35 | echo -n "Starting rpcbind daemon..." |
| 36 | if pidof /sbin/rpcbind >/dev/null; then |
| 37 | echo "already running." |
| 38 | exit 0 |
| 39 | fi |
| 40 | start-stop-daemon --start --quiet --exec /sbin/rpcbind -- "$@" |
| 41 | if [ $? -eq 0 ]; then |
| 42 | echo "done." |
| 43 | else |
| 44 | echo "failed." |
| 45 | fi |
| 46 | } |
| 47 | |
| 48 | stop () |
| 49 | { |
| 50 | echo "Stopping rpcbind daemon..." |
| 51 | if ! pidof /sbin/rpcbind >/dev/null; then |
| 52 | echo "not running." |
| 53 | return 0 |
| 54 | fi |
| 55 | start-stop-daemon --stop --quiet --exec /sbin/rpcbind |
| 56 | if [ $? -eq 0 ]; then |
| 57 | echo "done." |
| 58 | else |
| 59 | echo "failed." |
| 60 | fi |
| 61 | } |
| 62 | |
| 63 | case "$1" in |
| 64 | start) |
| 65 | start $OPTIONS |
| 66 | ;; |
| 67 | stop) |
| 68 | stop |
| 69 | ;; |
| 70 | force-reload) |
| 71 | stop |
| 72 | start $OPTIONS |
| 73 | ;; |
| 74 | restart) |
| 75 | stop |
| 76 | start $OPTIONS |
| 77 | ;; |
| 78 | status) |
| 79 | status /sbin/rpcbind |
| 80 | ;; |
| 81 | *) |
| 82 | echo "Usage: /etc/init.d/rpcbind {start|stop|force-reload|restart|status}" |
| 83 | exit 1 |
| 84 | ;; |
| 85 | esac |
| 86 | |
| 87 | exit $? |