Tuesday, October 20, 2009

OS X 10.4 nis client

OS X 10.4 nis client
http://zhadum.org.uk/2007/02/16/mac-os-x-and-nis-just-not-good-friends/

Nis on 10.4 is broken and need a script to stop the lgin from locking up.

sudo -s
echo "nohup /usr/local/bin/fix-nis 25 >/tmp/fix-nis.log 2>&1 &" >> /etc/rc.local
chmod +x /etc/rc.local

mkdir /usr/local
mkdir /usr/local/bin/
nano /usr/local/bin/fix-nis

#!/bin/sh
if [ $# -gt 0 ]
then
sleep "$1"
fi

NFSDIR=/home/staff/doug
if [ -d $NFSDIR ]
then
echo "Directory \"$NFSDIR\" exists."
exit 1
fi

killall lookupd
sleep 1
killall -HUP automount
sleep 2

if [ ! -d $NFSDIR ]
then
echo "Directory \"$NFSDIR\" still doesn't exists, retrying."

sleep 10
killall lookupd
sleep 1
killall -HUP automount
sleep 2
if [ ! -d $NFSDIR ]

then
echo "Directory \"$NFSDIR\" still doesn't exists, giving up"
exit 1
fi
fi

echo "Fixed NIS."
exit 0

chmod +x /usr/local/bin/fix-nis


No comments: