summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-nds/ypbind/files/ypbind.rc5')
-rw-r--r--net-nds/ypbind/files/ypbind.rc559
1 files changed, 59 insertions, 0 deletions
diff --git a/net-nds/ypbind/files/ypbind.rc5 b/net-nds/ypbind/files/ypbind.rc5
new file mode 100644
index 000000000000..82de473eecde
--- /dev/null
+++ b/net-nds/ypbind/files/ypbind.rc5
@@ -0,0 +1,59 @@
+#!/bin/sh
+#RCUPDATE:3 4:72:This line is required for script management
+
+. /etc/rc.d/config/functions
+. /etc/rc.d/config/basic
+
+SERVICE=ypbind
+EXE="/usr/sbin/ypbind"
+PID="/var/run/ypbind.pid"
+opts="start stop restart"
+
+start() {
+ ebegin "Starting ${SERVICE}"
+ if [ -n "$YP_DOMAIN" ]
+ then
+
+
+ ypdomainname "$YP_DOMAIN"
+ start-stop-daemon --start --quiet --exec $EXE 1>&2
+ if [ -n "$?" ]
+ then
+ notfound=1
+ for i in 0 1 2 3 4 5 6 7 8 9
+ do
+ ypwhich &>/dev/null && { notfound=0; break; };
+ sleep 1;
+ eend 0
+ done
+ if [ $notfound -eq 1 ]
+ then
+ eend 1 "No NIS server found"
+ fi
+ else
+ eend $? "Error starting ${SERVICE}."
+ fi
+ else
+ eend 1 "Error starting ${SERVICE}."
+ fi
+}
+
+stop() {
+ if [ -n "$YP_DOMAIN" ]
+ then
+ ebegin "Stopping ${SERVICE}"
+ start-stop-daemon --stop --quiet -s 9 --pid $PID 1>&2
+ eend $? "Error stopping ${SERVICE}."
+ # Remove binding files, if ypbind "forget" it
+ rm -f /var/yp/binding/*
+ rm -f $PID
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+doservice ${@}
+