#!/bin/sh #ident "@(#)netbios 1.9 03 Nov 1998 SMI" #Copyright 1998 Sun Microsystems Inc # Copyright 1990 NCR Corporation - Dayton, Ohio, USA # # # TLI NetBIOS startup # # # ********************************************************************** nodename=`/usr/bin/uname -n` NBHOME=/opt/SUNWlznb/sbin NBHOMEETC=/etc/opt/SUNWlznb NBHOMEVAR=/var/opt/SUNWlznb # ********************************************************************** EGREP=/usr/bin/egrep GREP=/usr/bin/grep MV=/usr/bin/mv # ************************************************************************* # This function will automatic load cache from the database if configured. # ************************************************************************* addNameCache() { sh $NBHOME/nbnsName.add return 0 } # ************************************************************************* # This function will configure WINS # ************************************************************************* addWinsConf() { if [ -f $NBHOMEVAR/fnbwins.info ]; then echo "Loading WINS configuration" $NBHOME/winsconf -f echo "Loading WINS configuration complete" fi return 0 } # ********************************************************************** # Start of netbios script # ********************************************************************** . OSVERSION=`uname -r` OS=`uname -s` if [ \( "$OSVERSION" = "5.6" -o "$OSVERSION" = "5.5.1" -o "$OSVERSION" = "5.7" \) -a "$OS" = "SunOS" ]; then NBHOME=/opt/SUNWlznb/sbin netD=/opt/SUNWlznb/sbin NBHOMEETC=/etc/opt/SUNWlznb NBHOMEVAR=/var/opt/SUNWlznb else echo "Unsupported OS" exit 1 fi case $1 in 'start') exitFlag=1 pid=`ps -e | awk ' $4 == "nbdaemon" { print $1 }'` if [ -z "$pid" ]; then echo "\nNetBIOS Network Initialization Start...." sh $NBHOME/autoconfig yes # normal case, build nbconfig if [ $? -eq 0 ]; then $netD/nbdaemon if [ $? -eq 0 ]; then # check if NetBIOS started # Changed the loop count to quicken the process - ES951318 # for i in 0 1 2 3 4 5 6; do # sleep 5 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do sleep 2 $NBHOME/nbmem check | $GREP "NetBIOS Started" >/dev/null 2>&1 if [ $? -eq 0 ]; then addWinsConf addNameCache exitFlag=0 break fi done fi fi if [ "$exitFlag" -ne 0 ]; then echo "NetBIOS Network Initialization Failed." exit 1 else echo "NetBIOS Network Initialization Complete." fi else echo "NetBIOS is already running." fi exit 0 ;; 'stop') pid=`ps -e | awk ' $4 == "nbdaemon" { print $1 }'` if [ -n "$pid" ] then if [ $pid -gt 0 ] then kill $pid sleep 5 fi fi echo "\nNetBIOS Network Shutdown Complete.\n" exit 0 ;; *) echo "usage: $0 [-u] [start|stop]" exit 1 esac