Added sched module for the loop
This commit is contained in:
parent
311c6eb19b
commit
4fc9db3bd5
1 changed files with 18 additions and 2 deletions
|
|
@ -14,6 +14,9 @@ import signal
|
|||
from socket import getfqdn
|
||||
import argparse
|
||||
|
||||
import sched, time
|
||||
|
||||
|
||||
#url="http://url/to/info"
|
||||
|
||||
user_home=str(Path.home())
|
||||
|
|
@ -128,7 +131,7 @@ def run(url, group=''):
|
|||
url, group=load_config()
|
||||
|
||||
|
||||
def start():
|
||||
def start(sc):
|
||||
|
||||
# Get config from /etc/pastafari or ~/.config/pastafari
|
||||
|
||||
|
|
@ -136,11 +139,19 @@ def start():
|
|||
|
||||
url, group=load_config()
|
||||
|
||||
run(url, group)
|
||||
|
||||
sc.enter(60, 1, start, (sc,))
|
||||
|
||||
"""
|
||||
while True:
|
||||
|
||||
run(url, group)
|
||||
|
||||
sleep(60)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
|
||||
|
|
@ -150,5 +161,10 @@ if __name__=='__main__':
|
|||
|
||||
signal.signal(signal.SIGINT, catch_signal)
|
||||
|
||||
start()
|
||||
#start()
|
||||
s=sched.scheduler(time.time, time.sleep)
|
||||
|
||||
#s.enter(60, 1, start, (s,))
|
||||
start(s)
|
||||
s.run()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue