Пример #1
0
import string
sys.path.append('/home/scripts/libs')
from myDaemon import runAsDaemon

from mySockets import mySockets
from myMQTT import myMQTT
from myLogs import myLogs
import json


client = myMQTT()
def _start():
    client.reload()
    client.connect(True)
    client.loop()
    client.disconnect()

def _cleanup(signum, frame):
    client.disconnect()
    quit()

def _reload(signum, frame):
    client.reload()


if len(sys.argv) > 1 and sys.argv[1] == 'no-daemon':
    _start()
else:
    runAsDaemon(_start, _cleanup, _reload)
Пример #2
0
sys.path.append('/home/scripts/libs')
sys.path.append('/home/scripts/libs/python3')
from myDaemon import runAsDaemon
import json

from mySockets import mySockets
from myTelegram import myTelegram

myTelegram = myTelegram()
myTelegram.setTimeout(60)

#def _start():
#myTelegram.startBot()


def _cleanup(signum, frame):
    #thread_obj.start()
    #mySock.close()
    #myTelegram.stop()
    #thread_obj.stop() #stop thread
    quit()


def _reload(signum, frame):
    print("TODO: Reloading")


#_start()
#runAsDaemon(_start, _cleanup, _reload);
runAsDaemon(myTelegram.start, _cleanup, _reload)