mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-09-13 12:10:12 +02:00
build
This commit is contained in:
@@ -26,6 +26,8 @@ def signal_handler(sig, frame):
|
|||||||
conn.close()
|
conn.close()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
file_path = os.path.realpath(__file__)
|
file_path = os.path.realpath(__file__)
|
||||||
dir_path = os.path.dirname(file_path)
|
dir_path = os.path.dirname(file_path)
|
||||||
@@ -50,6 +52,7 @@ status, output = subprocess.getstatusoutput(cmnd)
|
|||||||
if int(output) > 0:
|
if int(output) > 0:
|
||||||
print("Running already!")
|
print("Running already!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def is_port_open(host, port):
|
def is_port_open(host, port):
|
||||||
try:
|
try:
|
||||||
sock = socket.create_connection((host, port))
|
sock = socket.create_connection((host, port))
|
||||||
@@ -208,7 +211,7 @@ def send_mqtt_message(topic,msg,qos=0,retain=False):
|
|||||||
client2.connect("mqtt.home.lan",1883,60)
|
client2.connect("mqtt.home.lan",1883,60)
|
||||||
client2.publish(topic, json.dumps(msg), qos=qos, retain=retain)
|
client2.publish(topic, json.dumps(msg), qos=qos, retain=retain)
|
||||||
client2.disconnect()
|
client2.disconnect()
|
||||||
logging.info(f"Message sent {topic}, {msg}")
|
logging.info(f"Message1 sent {topic}, {msg}")
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logging.error("Failed to send")
|
logging.error("Failed to send")
|
||||||
print("Failed to send")
|
print("Failed to send")
|
||||||
@@ -642,6 +645,8 @@ def backup_job(server):
|
|||||||
topic = "sectorq/backups/start"
|
topic = "sectorq/backups/start"
|
||||||
logging.info(f"LALA : {topic}")
|
logging.info(f"LALA : {topic}")
|
||||||
send_mqtt_message(topic, "finished",qos=2,retain=True)
|
send_mqtt_message(topic, "finished",qos=2,retain=True)
|
||||||
|
return "finished"
|
||||||
|
|
||||||
|
|
||||||
topic = "sectorq/amd/restore"
|
topic = "sectorq/amd/restore"
|
||||||
for s in servers:
|
for s in servers:
|
||||||
|
Reference in New Issue
Block a user