commit message from python script

This commit is contained in:
2024-02-12 21:51:11 +01:00
parent 1321c9b068
commit a47474a9f5

View File

@@ -5,7 +5,7 @@ import os, time
def check_ping(hostname = str): def check_ping(hostname = str):
response = os.system("ping -c 1 " + hostname) response = os.system("timeout 0.2 ping -c 1 " + hostname + '&> /dev/null')
# and then check the response... # and then check the response...
if response == 0: if response == 0:
return True return True
@@ -38,18 +38,20 @@ def rclone_folders_copy(folder_to_sync=list, dest_folder = str):
if __name__ == "__main__": if __name__ == "__main__":
nextcloud_server = "schlaubistechtalk.de"
folder_to_sync_manuell = ['ssh_keys', 'frei', 'Doku','Joplin', 'Hack'] folder_to_sync_manuell = ['ssh_keys', 'frei', 'Doku','Joplin', 'Hack']
print("Check online status") print("Check online status von", nextcloud_server)
for check_count in range(1,10): for check_count in range(1,10):
print(check_count) if check_ping(hostname=nextcloud_server) is True:
# if check_ping(hostname="schlaubistechtalk.de") is True: print(nextcloud_server, "ist erreichbar...")
# break if rclone_folders_copy(folder_to_sync=folder_to_sync_manuell, dest_folder="/home/jonnybravo/.nextcloud") is True:
print("Lauf", check_count, "warte 10 Sekunden..",sep=" ") print("Sync erfolgreich")
time.sleep(2) else:
print("Sync nicht erfolgreich !!")
if rclone_folders_copy(folder_to_sync=folder_to_sync_manuell, dest_folder="/home/jonnybravo/.nextcloud") is True: break
print("Sync erfolgreich") print(check_count, "warte 10 Sekunden..",sep=" ")
time.sleep(10)
else: else:
print("Sync nicht erfolgreich !!") raise RuntimeError(nextcloud_server + " not connect")