| 24 | | * Some initializations are performed (which disk is the script supposed to analyze, logging, ...) |
| 25 | | * |
| 26 | | |
| | 24 | * First, some initializations are performed (which disk is the script supposed to analyze, logging, ...) |
| | 25 | * If the last analyzed directory has been analyzed less than {{{Constants.max_refresh_interval}}} (= 6 hours) seconds ago, stop the script (otherwise the script is likely still running or has been intentionally killed) |
| | 26 | * Run an infinite loop |
| | 27 | * Get a directory to analyze (one of the 256 /export/<hostname>.<disk>/nebulous directories). Each directory has its own table: {{{neb_<disk>_<directory name>}}}, e.g. {{{neb_1_a4}}} is associated to the {{{/export/<hostname>.1/nebulous/a4}}} directory |
| | 28 | * Run {{{updatedb}}} on the directory to analyze (a faster implementation of updatedb/mlocate is installed) |
| | 29 | * Get all ins_id (nebulous instance id) from the {{{FilesMonitoring}}} database and the {{{mlocate}}} database: |
| | 30 | * Mark the files which are in the {{{FilesMonitoring}}} database but not in the {{{mlocate}}} database as deleted; |
| | 31 | * Add the files which are in the {{{mlocate}}} database but not in the {{{FilesMonitoring}}} database (since they are "new" files). New entries are undefined; |
| | 32 | * Optimize the related mysql table |
| | 33 | * Refresh the status of a maximum of {{{Constants.limit_undefined}}} (=10000) undefined entries using the {{{NodeRelated/update_table_undefined.py}}} script |
| | 34 | * Refresh the status of a maximum of {{{Constants.limit}}} (=1000) oldest entries using the {{{NodeRelated/update_table.py}}} script |
| | 35 | * Update the refresh_status information: set the last analyzed directory of the current disk to the current directory (timestamp is automatically updated). |
| | 36 | * Sleep for a while ({{{Constants.sleep}}} = 10 seconds ) |