]>
Commit | Line | Data |
---|---|---|
374a4481 JR |
1 | #!/bin/sh |
2 | # | |
3 | # rpcbind Start/Stop RPC universal addresses to RPC program number mapper | |
4 | # | |
5 | # chkconfig: 345 11 89 | |
6 | # | |
7 | # description: The rpcbind utility is a server that converts RPC program \ | |
8 | # numbers into universal addresses. It must be running on \ | |
9 | # the host to be able to make RPC calls on a server on that \ | |
10 | # machine. | |
11 | # processname: rpcbind | |
12 | ||
13 | ||
14 | # Source function library | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
17 | # Get network config | |
18 | . /etc/sysconfig/network | |
19 | ||
20 | # Get service config | |
21 | [ -f /etc/sysconfig/rpcbind ] && . /etc/sysconfig/rpcbind | |
22 | ||
23 | # Check that networking is up. | |
24 | if is_yes "${NETWORKING}"; then | |
25 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
26 | msg_network_down rpcbind | |
27 | exit 1 | |
28 | fi | |
29 | else | |
30 | exit 0 | |
31 | fi | |
32 | ||
33 | start() { | |
34 | # Check if the service is already running? | |
35 | if [ ! -f /var/lock/subsys/rpcbind ]; then | |
374a4481 JR |
36 | is_no "${RPCBIND_VERBOSE}" || RPCBIND_OPTIONS="${RPCBIND_OPTIONS} -l" |
37 | is_yes "${RPCBIND_INSECURE}" && RPCBIND_OPTIONS="${RPCBIND_OPTIONS} -i" | |
38 | [ -z "${RPCBIND_ADDRESSES}" ] || \ | |
39 | for a in $RPCBIND_ADDRESSES ; do | |
40 | RPCBIND_OPTIONS="${RPCBIND_OPTIONS} -h $a" | |
41 | done | |
42 | msg_starting rpcbind | |
43 | daemon rpcbind ${RPCBIND_OPTIONS} | |
44 | RETVAL=$? | |
45 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rpcbind | |
46 | else | |
47 | msg_already_running rpcbind | |
48 | fi | |
49 | } | |
50 | ||
51 | stop() { | |
52 | if [ -f /var/lock/subsys/rpcbind ]; then | |
53 | msg_stopping rpcbind | |
54 | killproc rpcbind | |
55 | rm -f /var/lock/subsys/rpcbind | |
56 | else | |
57 | msg_not_running rpcbind | |
58 | fi | |
59 | } | |
60 | ||
61 | RETVAL=0 | |
62 | # See how we were called. | |
63 | case "$1" in | |
64 | start) | |
65 | RPCBIND_OPTIONS= | |
66 | start | |
67 | ;; | |
68 | stop) | |
69 | stop | |
70 | ;; | |
71 | cleanup) | |
72 | stop | |
73 | RPCBIND_OPTIONS= | |
74 | start | |
75 | ;; | |
76 | restart|force-reload) | |
77 | stop | |
78 | RPCBIND_OPTIONS="-w" | |
79 | start | |
80 | ;; | |
81 | status) | |
82 | status rpcbind | |
83 | exit $? | |
84 | ;; | |
85 | *) | |
86 | msg_usage "$0 {start|stop|restart|force-reload|cleanup|status}" | |
87 | exit 3 | |
88 | esac | |
89 | ||
90 | exit $RETVAL |