Hi,
(by the way, this site is one of the best forum (display) I 've seen).
I have a big issue I would like to resolve, let me explain;
I have built a script where I can put IPs into a list and then once I press 0,
this list is immediately pinged and the result of each ping are provided into the python IDLE.
But now, I would like to have this script to be started at a certain time of the day what do you suggest me ? Do you have suggestion to schedule a scritp to start ? Should I use a timer ? should I use a scheduler? (don't want windows task sked)...
Some people are providing me this script below but I have a hard time to place my parameters within this script, I don't have all the skill to perform such task as python is totally new to me. Here is the script; (where should I put my target name ?, what args should I use ?... should I use kwargs ?
tks to give me any hint...
# -*- coding: cp1252 -*-
import threading
import time
class MyTimer:
def __init__(self, tempo, target, args= [], kwargs={}):
self._target = target
self._args = args
self._kwargs = kwargs
self._tempo = tempo
def _run(self):
self._timer = threading.Timer(self._tempo, self._run)
self._timer.start()
self._target(*self._args, **self._kwargs)
def start(self):
self._timer = threading.Timer(self._tempo, self._run)
self._timer.start()
def stop(self):
self._timer.cancel()
def affiche(unstr):
print unstr, time.clock()
a = MyTimer(1.0, affiche, ["MyTimer"])
a.start()
time.sleep(5.5)
print u"Timer stopped"
a.stop()