mbligh | 7c8ea99 | 2009-06-22 19:03:08 +0000 | [diff] [blame^] | 1 | #!/usr/bin/python |
mbligh | e48bcfb | 2008-11-11 17:09:44 +0000 | [diff] [blame] | 2 | # |
| 3 | # Script for tailing one to many logfiles and merging their output. |
| 4 | |
| 5 | import optparse, os, signal, sys |
| 6 | |
| 7 | import monitors_util |
| 8 | |
| 9 | usage = 'usage: %prog [options] follow_path ...' |
| 10 | parser = optparse.OptionParser(usage=usage) |
| 11 | parser.add_option( |
| 12 | '-l', '--lastlines_dirpath', |
| 13 | help='Path to store/read last line data to/from.') |
| 14 | |
| 15 | |
| 16 | def main(): |
| 17 | (options, follow_paths) = parser.parse_args() |
| 18 | if len(follow_paths) < 1: |
| 19 | parser.print_help() |
| 20 | sys.exit(1) |
| 21 | |
| 22 | monitors_util.follow_files( |
| 23 | follow_paths, sys.stdout, options.lastlines_dirpath) |
| 24 | |
| 25 | |
| 26 | if __name__ == '__main__': |
| 27 | main() |