Code is as below. I will explain here.
I use fabric to check the mount point status for 2 server. The command is
df -h /mnt
The problem of this command is that it may hang there forever, so the fabric code will hang forever. I think some timeout mechanism will fix this issue. But I did not find it on the fabric doc. Is there any setting about this ?
import fabric
from fabric import ThreadingGroup as Group
directory = '/mnt'
group = Group('server1', 'server2', user='someuser', connect_kwargs={'password':'somepassword'})
try:
result = group.run("df -h %s" % directory)
except fabric.exceptions.GroupException as e:
err = e
pass