proNlp1/daemon.py

35 lines
695 B
Python

from threading import Thread, Lock
from time import gmtime, strftime
from infoRet import get_data_rss
class Daemon(Thread):
def __init__(self):
Thread.__init__(self)
self.mutex = Lock()
self._quit = False
def stopped(self):
self.mutex.acquire()
val = self._quit
self.mutex.release()
return val
def stop(self):
self.mutex.acquire()
self._quit = True
self.mutex.release()
def run(self):
while True:
if str(strftime("%H:%M:%S", gmtime())) == '05:00:00':
get_data_rss()
def main_fct():
t = Daemon()
t.start()
if __name__ == "__main__":
main_fct()