Reputation: 148
I know how to get current system date and time using datetime in python. Is there any way to get date and time of another system in the same network using python language ? I googled it a lot but didn't find anything useful. Basically, I'm using beaglebone black (using usb ethernet connection with host) to implement traffic management system. Using datetime, program returns time of beaglebone. Instead i want host system's time. how can i do that ?
Upvotes: 3
Views: 2146
Reputation: 4649
Here is a solution, make sure that the client machine has been authorized to log into the destination machine without inputting a password,
python code:
import os
remote_date = os.popen("ssh user@yourhost date").readline()
print remote_date
output:
Thu Jan 1 13:33:48 CST 2015
maybe helpful to you:)
Upvotes: 5