script that sends users logged in data from a folder. Folder contains all the hostnames and their users logged in.
Really what I want generated is a json file containing every hostname and userslogged in.
In [28]:
import os
In [29]:
os.system('rsync -azP wcmckee@192.168.1.2:/home/wcmckee/sellcoffee/ /home/wcmckee/sellcoffee/')
Out[29]:
In [30]:
mylis = os.listdir('/home/wcmckee/sellcoffee/hostnames/')
In [31]:
jsdict = dict()
In [32]:
for lis in mylis:
print lis
rdhos = open('/home/wcmckee/sellcoffee/hostnames/' + lis, 'r')
hosrdz = rdhos.read()
jsdict.update({lis: hosrdz})
In [ ]:
jsdict
In [34]:
jsdict.keys()[0]
Out[34]:
In [35]:
jsdict.values()[0]
Out[35]:
In [36]:
jsdict.keys()[1]
Out[36]:
In [37]:
jsdict.values()[1]
Out[37]:
In [38]:
jsdict.keys()[2]
Out[38]:
In [39]:
jsdict.keys()[3]
Out[39]:
In [42]:
jsdict.values()[2]
Out[42]:
In [43]:
jsdict.values()[3]
Out[43]:
In [ ]: