2 Commity 8dc5d502a6 ... d622debaea

Autor SHA1 Wiadomość Data
  czobor d622debaea table.csv example for local machine 3 lat temu
  czobor 5ae1464470 Adding main.py 3 lat temu
2 zmienionych plików z 15 dodań i 0 usunięć
  1. 12 0
      main.py
  2. 3 0
      table.csv

+ 12 - 0
main.py

@@ -0,0 +1,12 @@
+import csv
+import subprocess
+import sys
+
+user = sys.argv[1]
+table = [line for line in csv.reader(open('table.csv'))]
+
+for ip, latitude, longitude in table[1:]:
+    print(ip, latitude, longitude)
+    command = f'echo "Ip: {ip}; geo: {latitude},{longitude}" >> server_config'
+    subprocess.call(f'ssh {user}@{ip} {command}'.split())
+

+ 3 - 0
table.csv

@@ -0,0 +1,3 @@
+ip,latitude,longitude
+localhost,-0.7432,1.4712
+127.0.0.1,0,0.33328