JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



Bug in getting the expected result


T

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam toker
Posts: 1 - Registered: 2008-07-17 22:40:50

Hello All,
I have written a program which in while 1 loop will keep checking the pinging of some pc.If it is not pinging, it will simply try to restart it using VISION ICE command line commands.Here is this program :-

#Imports
import sys
import os
sys.path = sys.path +
# Import the Boot Library
import boot_library as Lib

TgtDownCount = (0)
TgtDownCountReset = (0)
expectedValue = (0)
MaxTgtDownValue = (3)
while 1:
#Check whether the target is up and running
x = os.system("ping 10.1.20.169")
#Check for validity "0" if connected
#print "X value is : " + x
if expectedValue == x:
print "Connected"
else:
# Do nothing
print "Not Connected"
print "Trying to re-connect"
TgtDownCount = TgtDownCount + 1
if MaxTgtDownValue > TgtDownCount:
TgtDownCount = TgtDownCountReset
# Reconnect the Target commands
Lib.ResetTarget()
Lib.RunTarget()
print "Re-connected"

This program is working fine.Problem Im facing is if the pc goes down in between, this code won't go to else part unless and until I press ctrl C.If I press ctrl C, it will enter the else part n re-connect...What I want is as soon as pc goes down, automatically it shall get re-connected through this script..
Please help me out at the earliest...
Thanks a lot.
Regards,
Geeta






JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising