Function TimeSleep(N)
This commit is contained in:
parent
eba92fa9b4
commit
0523193ac9
|
@ -136,36 +136,16 @@ def LockProcess():
|
||||||
createLock.write(str(random.randrange(135790)))
|
createLock.write(str(random.randrange(135790)))
|
||||||
createLock.close()
|
createLock.close()
|
||||||
|
|
||||||
#Function to sleep 60 seconds.
|
#Function to sleep 'N' seconds.
|
||||||
def TimeSleep60():
|
def TimeSleep(N):
|
||||||
Time=1
|
Time=1
|
||||||
while Time < 60:
|
while Time < N:
|
||||||
createLock=open('ip2e.lock','w')
|
createLock=open('ip2e.lock','w')
|
||||||
createLock.write(str(random.randrange(135790)))
|
createLock.write(str(random.randrange(135790)))
|
||||||
createLock.close()
|
createLock.close()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
Time=Time + 1
|
Time=Time + 1
|
||||||
|
|
||||||
#Function to sleep 10 seconds.
|
|
||||||
def TimeSleep10():
|
|
||||||
Time=1
|
|
||||||
while Time < 10:
|
|
||||||
createLock=open('ip2e.lock','w')
|
|
||||||
createLock.write(str(random.randrange(135790)))
|
|
||||||
createLock.close()
|
|
||||||
time.sleep(1)
|
|
||||||
Time=Time + 1
|
|
||||||
|
|
||||||
#Function to sleep 10 minutes.
|
|
||||||
def TimeSleep600():
|
|
||||||
Time=1
|
|
||||||
while Time < 600:
|
|
||||||
createLock=open('ip2e.lock','w')
|
|
||||||
createLock.write(str(random.randrange(13579)))
|
|
||||||
createLock.close()
|
|
||||||
time.sleep(1)
|
|
||||||
Time=Time + 1
|
|
||||||
|
|
||||||
#Check if exists a previous log.file
|
#Check if exists a previous log.file
|
||||||
if os.path.isfile("ip2e.log"):
|
if os.path.isfile("ip2e.log"):
|
||||||
createlog=open('ip2e.log','w')
|
createlog=open('ip2e.log','w')
|
||||||
|
@ -184,7 +164,7 @@ OrangeColor()
|
||||||
print ("[ip2e-daemon] ["+CurrentTime+"] Waiting 60 seconds...")
|
print ("[ip2e-daemon] ["+CurrentTime+"] Waiting 60 seconds...")
|
||||||
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Waiting 60 seconds...\n")
|
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Waiting 60 seconds...\n")
|
||||||
editlog.close()
|
editlog.close()
|
||||||
TimeSleep60()
|
TimeSleep(60)
|
||||||
|
|
||||||
PublicIP = 1
|
PublicIP = 1
|
||||||
while PublicIP <= 2:
|
while PublicIP <= 2:
|
||||||
|
@ -213,7 +193,7 @@ while PublicIP <= 2:
|
||||||
print ("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...")
|
print ("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...")
|
||||||
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Error getting IP\n")
|
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Error getting IP\n")
|
||||||
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...\n")
|
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...\n")
|
||||||
TimeSleep10()
|
TimeSleep(10)
|
||||||
#Read IP log file & get the current IP
|
#Read IP log file & get the current IP
|
||||||
readfileIP=open('IP.log', 'r')
|
readfileIP=open('IP.log', 'r')
|
||||||
CurrentIPRaw=readfileIP.read()
|
CurrentIPRaw=readfileIP.read()
|
||||||
|
@ -270,7 +250,7 @@ while PublicIP <= 2:
|
||||||
print ("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...")
|
print ("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...")
|
||||||
editlog.write(MailMessage+" ("+ToEmail+")\n")
|
editlog.write(MailMessage+" ("+ToEmail+")\n")
|
||||||
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...\n")
|
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Retrying in 10 seconds...\n")
|
||||||
TimeSleep10()
|
TimeSleep(10)
|
||||||
#Remove the previous IP log file & create a new.
|
#Remove the previous IP log file & create a new.
|
||||||
ip2eIPcf=open('IP.log','w')
|
ip2eIPcf=open('IP.log','w')
|
||||||
ip2eIPcf.write(NewIP)
|
ip2eIPcf.write(NewIP)
|
||||||
|
@ -282,4 +262,4 @@ while PublicIP <= 2:
|
||||||
print ("[ip2e-daemon] ["+CurrentTime+"] Next update in 10 minutes...")
|
print ("[ip2e-daemon] ["+CurrentTime+"] Next update in 10 minutes...")
|
||||||
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Next update in 10 minutes...\n")
|
editlog.write("[ip2e-daemon] ["+CurrentTime+"] Next update in 10 minutes...\n")
|
||||||
editlog.close()
|
editlog.close()
|
||||||
TimeSleep600()
|
TimeSleep(600)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user