FeD:Projekte/ProcLogView/source

Aus Förderverein euregionale Digitalkultur e.V.

Wechseln zu: Navigation, Suche
#!/usr/bin/python
 
from time import sleep
import sys
 
foo = open(sys.argv[1])
 
def tail_f(file):
  interval = 1.0
  file.seek(0, 2)
 
  while True:
    where = file.tell()
    line = file.readline()
    if not line:
      sleep(interval)
      file.seek(where)
    else:
      yield line
 
 
for line in tail_f(foo):
    print "%s" % line