mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-07-01 15:48:33 +02:00
lala
This commit is contained in:
@ -19,7 +19,9 @@ pid = os.getpid()
|
||||
host = platform.node().lower()
|
||||
cmnd = "ps -ef|grep omv_backups.py|grep -v grep |grep -v {}|wc -l".format(pid)
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
|
||||
if int(output) > 0:
|
||||
print("Running already!")
|
||||
sys.exit()
|
||||
def is_port_open(host, port):
|
||||
try:
|
||||
sock = socket.create_connection((host, port))
|
||||
@ -29,13 +31,14 @@ def is_port_open(host, port):
|
||||
return False
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
# doesn't even have to be reachable
|
||||
s.connect(('192.168.77.1', 1))
|
||||
IP = s.getsockname()[0]
|
||||
print(IP)
|
||||
print(output)
|
||||
if int(output) > 0:
|
||||
print("Running already!")
|
||||
sys.exit()
|
||||
conn = False
|
||||
while not conn:
|
||||
s.connect(('192.168.77.1', 1))
|
||||
IP = s.getsockname()[0]
|
||||
print(IP)
|
||||
print(output)
|
||||
time.sleep(5)
|
||||
|
||||
broker = 'mqtt.home.lan'
|
||||
port = 1883
|
||||
topic_sum = "sectorq/omv/backups"
|
||||
|
Reference in New Issue
Block a user