Skip to content

Instantly share code, notes, and snippets.

@higebu
Created September 15, 2012 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save higebu/3727544 to your computer and use it in GitHub Desktop.
Save higebu/3727544 to your computer and use it in GitHub Desktop.
tailf.py
#!/usr/bin/env python
import subprocess
filename = 'test.log'
cmd = ('tail -n +1 --follow=name ' + filename)
p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
print p.stdout.readline()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment