summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/rpcbind/rpcbind/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/rpcbind/rpcbind/init.d')
-rw-r--r--meta/recipes-extended/rpcbind/rpcbind/init.d87
1 files changed, 87 insertions, 0 deletions
diff --git a/meta/recipes-extended/rpcbind/rpcbind/init.d b/meta/recipes-extended/rpcbind/rpcbind/init.d
new file mode 100644
index 0000000000..67499aa828
--- /dev/null
+++ b/meta/recipes-extended/rpcbind/rpcbind/init.d
@@ -0,0 +1,87 @@
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
22test -f /sbin/rpcbind || exit 0
23
24OPTIONS=""
25if [ -f /etc/default/rpcbind ]
26then
27 . /etc/default/rpcbind
28elif [ -f /etc/rpcbind.conf ]
29then
30 . /etc/rpcbind.conf
31fi
32
33start ()
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
48stop ()
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
63case "$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 ;;
85esac
86
87exit $?