commit message from python script
This commit is contained in:
@@ -19,7 +19,7 @@ def read_csv(csv_file = str):
|
||||
|
||||
|
||||
def ssh_connection(con_server = str, bash_script = """ls -lisaR /home; apt list --installed"""):
|
||||
with Popen(['ssh', '-T', con_server],
|
||||
with Popen(['ssh', '-T', str(con_server)],
|
||||
stdin=PIPE, stdout=PIPE, stderr=PIPE,
|
||||
universal_newlines=True) as p:
|
||||
output, error = p.communicate(bash_script)
|
||||
@@ -42,9 +42,12 @@ if __name__ == "__main__":
|
||||
|
||||
for count in range(0,len(read_csv(server_csv)['server'])):
|
||||
servername = read_csv(server_csv)['server'][count]
|
||||
con_username = read_csv(server_csv)['user'][count]
|
||||
user_server_con = str(con_username + '@' + servername)
|
||||
print(servername, "verbindng wird geprüft...",sep=' ')
|
||||
if ssh_check(con_server=servername) is True:
|
||||
print(servername, "erreichbar...", sep=' ')
|
||||
ssh_connection(con_server=user_server_con)
|
||||
else:
|
||||
print(servername, "nicht erreichbar oder kein ssh!!", sep=' ')
|
||||
#if ssh_check(con_server=servername) is True:
|
||||
|
||||
Reference in New Issue
Block a user