On 26 June 2014 14:39, leam hall <leamh...@gmail.com> wrote: > Python 2.4.3 > > Writing a function that takes the string from "ssh <server> ls -l > /var/log/yum.log" and tries to see if the file is more than a couple months > old. The goal is to only run python on the local server and it will ssh into > the remote server. > > Is there a better way to do this?
I'd probably rather try Paramiko's SFTPClient and retrieve the file modified date directly: http://paramiko-docs.readthedocs.org/en/latest/api/sftp.html#paramiko.sftp_client.SFTPClient (see the SFTPFile.stat() method in particular, which gives you back a stat object containing mtime, the modification datetime IIRC) 2 more (hopefully) useful links if you decide to go this route: http://www.saltycrane.com/blog/2010/02/python-paramiko-notes/ http://jessenoller.com/blog/2009/02/05/ssh-programming-with-paramiko-completely-different Walter _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor