Registro y salida chistosa
parent
a086bcc616
commit
b8da20c194
|
@ -4,19 +4,19 @@ import daemon
|
||||||
import time
|
import time
|
||||||
import signal
|
import signal
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
|
||||||
|
|
||||||
if not os.environ.get('HEARTBEAT'):
|
if not os.environ.get('HEARTBEAT'):
|
||||||
hb = 60 * 15 # 15 minutos
|
hb = 60 * 15 # 15 minutos
|
||||||
else:
|
else:
|
||||||
hb = int(os.environ.get('HEARTBEAT'))
|
hb = int(os.environ.get('HEARTBEAT'))
|
||||||
|
shouldIrun = True
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
async def main_loop():
|
async def main_loop():
|
||||||
await log.info('Demonio iniciado')
|
await log.info('Demonio iniciado')
|
||||||
doki = int(time.time()) + hb
|
doki = int(time.time()) + hb
|
||||||
while True:
|
while shouldIrun:
|
||||||
if await pre_process():
|
if await pre_process():
|
||||||
await enviaCorreos()
|
await enviaCorreos()
|
||||||
await asyncio.sleep(10)
|
await asyncio.sleep(10)
|
||||||
|
@ -31,7 +31,7 @@ def main():
|
||||||
|
|
||||||
def programCleanup(_signo, _stack_frame):
|
def programCleanup(_signo, _stack_frame):
|
||||||
log.info('Recibida señal de salida!')
|
log.info('Recibida señal de salida!')
|
||||||
sys.exit(0)
|
shouldIrun = False
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import daemon
|
||||||
import time
|
import time
|
||||||
import signal
|
import signal
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
if not os.environ.get('HEARTBEAT'):
|
if not os.environ.get('HEARTBEAT'):
|
||||||
|
@ -12,6 +11,9 @@ if not os.environ.get('HEARTBEAT'):
|
||||||
else:
|
else:
|
||||||
hb = int(os.environ.get('HEARTBEAT'))
|
hb = int(os.environ.get('HEARTBEAT'))
|
||||||
|
|
||||||
|
|
||||||
|
shouldIrun = True
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
mayordomo = create_async_smtp_server()
|
mayordomo = create_async_smtp_server()
|
||||||
|
@ -19,7 +21,7 @@ def main():
|
||||||
async def main_loop():
|
async def main_loop():
|
||||||
await log.info('Demonio iniciado')
|
await log.info('Demonio iniciado')
|
||||||
doki=int(time.time()) + hb
|
doki=int(time.time()) + hb
|
||||||
while True:
|
while shouldIrun:
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
i = int(time.time())
|
i = int(time.time())
|
||||||
if i >= doki:
|
if i >= doki:
|
||||||
|
@ -34,7 +36,7 @@ def main():
|
||||||
def programCleanup(_signo, _stack_frame):
|
def programCleanup(_signo, _stack_frame):
|
||||||
log.info('Recibida la señal de salida')
|
log.info('Recibida la señal de salida')
|
||||||
mayordomo.stop()
|
mayordomo.stop()
|
||||||
sys.exit(0)
|
shouldIrun = False
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue