Problem running hush shell script from within a script

Adam Rosenberg adam at alcorn.com
Mon Aug 9 17:36:01 UTC 2010


Denys,

Thank you for your help.  Your assumption that it was a race condition
was correct.  I have used the character device check that you
suggested to write this loop into my script and it now works 100% of
the time.

<----------------- cut here ----------------->
if [ "$1" == "start" ]
then
	LOOP=0;
	echo "Sub: Loading module"
	modprobe $DEVMODULE
	until [ -c $DEVDEVICE ]
	do
		# sleep for 200ms
		usleep 200000
		
		# quit waiting for the device after
                # 25 loops = 200ms*25 = 5 seconds
		if [ $LOOP -eq 25 ]
		then
			echo "Error: timeout waiting for $DEVDEVICE";
			rmmod $DEVMODULE
			exit -1
		fi
		LOOP=$(($LOOP + 1))
	done
	exit
fi
<----------------- cut here ----------------->

I owe you one.

Thanks,
Adam

Adam Rosenberg
Software Engineer

Alcorn McBride Inc.
3300 South Hiawassee
Building 105
Orlando, FL 32835

(407) 296 - 5800 ext. 5490


More information about the busybox mailing list