summaryrefslogtreecommitdiff
path: root/extra/ypbind-mt/ypbind
diff options
context:
space:
mode:
Diffstat (limited to 'extra/ypbind-mt/ypbind')
-rwxr-xr-xextra/ypbind-mt/ypbind55
1 files changed, 27 insertions, 28 deletions
diff --git a/extra/ypbind-mt/ypbind b/extra/ypbind-mt/ypbind
index 5ef5cf5b3..6a5ef11e3 100755
--- a/extra/ypbind-mt/ypbind
+++ b/extra/ypbind-mt/ypbind
@@ -2,35 +2,34 @@
. /etc/rc.conf
. /etc/rc.d/functions
+
. /etc/conf.d/ypbind
+. /etc/conf.d/nisdomainname
+
+name=ypbind
+PID=$(pidof -o %PPID /usr/sbin/ypbind)
case "$1" in
- start)
- stat_busy "Starting NIS Bind Daemon"
- [ -f /etc/defaultdomain ] && /bin/domainname -F /etc/defaultdomain
- /usr/sbin/ypbind $YPBIND_ARGS
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon ypbind
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping NIS Bind Daemon"
- killall -q /usr/sbin/ypbind
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon ypbind
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
+start)
+ stat_busy "Starting $name daemon"
+ [[ -n $NISDOMAINNAME ]] && /usr/bin/domainname "$NISDOMAINNAME" &>/dev/null
+ [[ -z "$PID" ]] && /usr/sbin/ypbind $YPBIND_ARGS &>/dev/null \
+ && { add_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+stop)
+ stat_busy "Stopping $name daemon"
+ [[ -n "$PID" ]] && kill $PID &>/dev/null \
+ && { rm_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+*)
+ echo "usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
esac