2 Commits 8dc5d502a6 ... d622debaea

Author SHA1 Message Date
  czobor d622debaea table.csv example for local machine 3 years ago
  czobor 5ae1464470 Adding main.py 3 years ago
2 changed files with 15 additions and 0 deletions
  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