Skip to content

Instantly share code, notes, and snippets.

@v0112358
Created May 31, 2018 01:52
Show Gist options
  • Save v0112358/f44c24df0c1fc36e409551a8151cbd01 to your computer and use it in GitHub Desktop.
Save v0112358/f44c24df0c1fc36e409551a8151cbd01 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
from pygtail import Pygtail
from pathlib2 import Path
try:
sys.argv[1]
except:
print "Usage: pygtail.py <path-to-log-file>"
else:
log_file = Path(str(sys.argv[1]))
if log_file.is_file():
for line in Pygtail(str(log_file)):
sys.stdout.write(line)
else:
print(log_file + " dose not exist !")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment