MCPcopy Index your code
hub / github.com/geekcomputers/Python / windows

Function windows

powerup_checks.py:43–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42
43def windows(): # This is the function to run if it detects the OS is windows.
44 f = open(outputfile, "a") # Open the logfile
45 for server in open(serverfile, "r"): # Read the list of servers from the list
46 # ret = subprocess.call("ping -n 3 %s" % server.strip(), shell=True,stdout=open('NUL', 'w'),stderr=subprocess.STDOUT) # Ping the servers in turn
47 ret = subprocess.call(
48 "ping -n 3 %s" % server.strip(),
49 stdout=open("NUL", "w"),
50 stderr=subprocess.STDOUT,
51 ) # Ping the servers in turn
52 if ret == 0: # Depending on the response
53 f.write(
54 "%s: is alive" % server.strip().ljust(15) + "\n"
55 ) # Write out to the logfile is the server is up
56 else:
57 f.write(
58 "%s: did not respond" % server.strip().ljust(15) + "\n"
59 ) # Write to the logfile if the server is down
60
61
62def linux(): # This is the function to run if it detects the OS is nix.

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected