Created
          October 26, 2016 07:32 
        
      - 
      
- 
        Save andre-brongniart/1a6320a92ec078a720d320fa048bc050 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env python | |
| import os, sys | |
| from os import path | |
| from datetime import datetime, timedelta | |
| def files(path): | |
| for file in os.listdir(path): | |
| if os.path.isfile(os.path.join(path, file)): | |
| yield file | |
| serverpath = "./testing_scripts/" | |
| docs = files(serverpath) | |
| _30_mins_ago = datetime.now() - timedelta(minutes=1) | |
| try: | |
| for doc in docs: | |
| doctime = datetime.fromtimestamp(path.getctime(serverpath + doc)) | |
| if doctime < _30_mins_ago: | |
| print doc + " more than 30 minutes old" | |
| else: | |
| print "All document root files checked for sftp user are less than 30 minutes old." | |
| sys.exit(0) | |
| except: | |
| sys.exit(0) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment