I can use the ping command and save the output using the following line:
command = os.system('ping 127.0.0.1 > new.txt')
However each time the script is run the text file is overwritten so I only have the last ping saved. I have looked into logging but cannot find a way to save the outputs of the ping requests into a text file without over writing.
I have tried:
logging.debug(command = os.system('ping 127.0.0.1'))
But this throws up an error with: debug() takes at least 1 argument (0 given)
Any help would be appreciated, thanks!
command = os.system('ping 127.0.0.1 >> new.txt')?