Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2005 21:20:07 -0600
From:      Vulpes Velox <v.velox@vvelox.net>
To:        freebsd-hackers@freebsd.org
Subject:   Re: RC scripts and NIS    UPDATE
Message-ID:  <20050112212007.633c2d7b@fennec.local.lan>
In-Reply-To: <20050111183439.75e6b334@fennec.local.lan>
References:  <20050111183439.75e6b334@fennec.local.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Well I got it working.

It adds two more variables to rc.conf.

nis_server_available_test: Toggles nis test on or off
nis_avail_tester: script to use for testing

If the script exits with a 1, NIS is not enabled. I am currently using
a script that ,using md5, hashes the out put from arp and compares it
to a good hash.

Any ways, not heard any feed back on this yet. I would be really
interested to hear some opinions or suggestions on this.

On Tue, 11 Jan 2005 18:34:39 -0600
Vulpes Velox <v.velox@vvelox.net> wrote:

> I am currently am currently working on making modifications to the
> rc system to allow NIS  to not be started if the server is not
> present.
> 
> So far I am just looking at disabling ypbind at start if certain
> conditions are meet. The idea it is to run a script that checks if
> the servers or server is present and then if it is, ypbind if
> enabled, if not it modifies the current variables to stop ypbind
> from being run and prints a message about it to stdout.
> 
> >From my understanding this is the one that needs disabled if the
> system is to operate outside of it's usual network. Allowing it to
> fall back to /etc/ for it's information. I've tested it by disabling
> it upon startup manually and it worked fine. Is there any other NIS
> related scripts I should make changes to, or is this the only one I
> should worry about?
> 
>  If any one have opinions or any input on any of this, I would be
> interested to hear it.

[-- Attachment #2 --]
#!/bin/sh
#
# $NetBSD: ypbind,v 1.5 2002/03/22 04:34:01 thorpej Exp $
# $FreeBSD: src/etc/rc.d/ypbind,v 1.8.2.1 2004/10/10 09:50:54 mtm Exp $
#

# PROVIDE: ypbind
# REQUIRE: ypserv
# BEFORE:  DAEMON

. /etc/rc.subr

name="ypbind"
command="/usr/sbin/${name}"
start_precmd="ypbind_precmd"

load_rc_config $name
rcvar="nis_client_enable"
command_args="${nis_client_flags}"

if checkyesno nis_server_available_test ; then

    nis_avail_test="/etc/rc.nisavailtester"

    if ! `grep -v --mmap ^# /etc/rc.conf | grep --mmap ^nis_avail_tester | tail -n 1 > /dev/null` ; then
	nis_avail_test="`grep -v --mmap ^# /etc/rc.conf | grep --mmap ^nis_avail_tester | tail -n 1 > /dev/null`"
    fi

    if ! `$nis_avail_test`; then
	echo Exiting ypbind now...
	exit
    fi

fi

ypbind_precmd()
{
	if ! checkyesno rpcbind_enable  && \
	    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
	then
		force_depend rpcbind || return 1
	fi

	_domain=`domainname`
	if [ -z "$_domain" ]; then
		warn "NIS domainname(1) is not set."
		return 1
	fi
}

run_rc_command "$1"

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050112212007.633c2d7b>