mirror of
https://gitlab.sectorq.eu/jaydee/python.git
synced 2025-12-14 02:34:53 +01:00
bitwarden
This commit is contained in:
@@ -88,17 +88,19 @@ backups = {
|
||||
}
|
||||
}
|
||||
BACKUP_FS = "/srv/dev-disk-by-uuid-2f843500-95b6-43b0-bea1-9b67032989b8"
|
||||
BACKUP_HOST = "omv.home.lan"
|
||||
BACKUP_HOST = "morefine.home.lan"
|
||||
if not host in backups:
|
||||
print(f"No backup jobs for {host}")
|
||||
sys.exit()
|
||||
print("Test connection")
|
||||
|
||||
hm = socket.gethostbyaddr("omv.home.lan")
|
||||
hm = socket.gethostbyaddr(BACKUP_HOST)
|
||||
|
||||
hostdown = True
|
||||
while hostdown:
|
||||
#HOST_UP = os.system(f"ping -c 1 -w 2 omv.home.lan") == 0
|
||||
cmnd = "ping -c 1 -w 2 omv.home.lan"
|
||||
cmnd = f"ping -c 1 -w 2 {BACKUP_HOST}"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
print(status)
|
||||
print(output)
|
||||
@@ -110,13 +112,12 @@ while hostdown:
|
||||
else:
|
||||
print("host up")
|
||||
hostdown = False
|
||||
host = "omv.home.lan"
|
||||
host = "morefine.home.lan"
|
||||
|
||||
port = 22 # Replace with the port you want to test
|
||||
if is_port_open(host, port):
|
||||
print(f"Port {port} on {host} is open.")
|
||||
if is_port_open(BACKUP_HOST, port):
|
||||
print(f"Port {port} on {BACKUP_HOST} is open.")
|
||||
else:
|
||||
print(f"Port {port} on {host} is closed.")
|
||||
print(f"Port {port} on {BACKUP_HOST} is closed.")
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user