Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import pexpect
- import time
- import datetime
- import os
- command = "sshfs -p 22 -o allow_other,uid=0,gid=15000,ro linuxlog@bgk50.bank.com.pl:/opt/webwasher-csm/logs /opt/proxy"
- password = "<YOUR_PASSWORD>"
- mounted_directory = "/opt/proxy";
- expect = "linuxlog@bgk50.bank.com.pl's password:";
- def check_mounted_point():
- try:
- point = pexpect.spawn(command)
- point.expect(expect)
- time.sleep (0.1)
- point.sendline (password)
- time.sleep (10)
- except Exception, e:
- print str(e)
- def main ():
- check_mounted_point()
- if __name__ == '__main__':
- if (os.path.ismount(mounted_directory) == False):
- now = datetime.datetime.now()
- print "Mounted point %s was not detected on %s" % (mounted_directory, now);
- main ()
- print "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement