Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the screen idea is the best idea, but if you're not wanting to ssh and you want a python script to do it. Here is a simple pythonic XMLRPC way of getting the info. It will only update when something has been appended to the file in question.</p> <p>This is the client file. You tell this which file you want to read from and what computer its on.</p> <pre><code>#!/usr/bin/python # This should be run on the computer you want to output the files # You must pass a filename and a location # filename must be the full path from the root directory, or relative path # from the directory the server is running # location must be in the form of http://location:port (i.e. http:localhost:8000) import xmlrpclib, time, sys, os def tail(filename, location): # connect to server s = xmlrpclib.ServerProxy(location) # get starting length of file curSeek = s.GetSize(filename) # constantly check while 1: time.sleep(1) # make sure to sleep # get a new length of file and check for changes prevSeek = curSeek # some times it fails if the file is being writter to, # we'll wait another second for it to finish try: curSeek = s.GetSize(filename) except: pass # if file length has changed print it if prevSeek != curSeek: print s.tail(filename, prevSeek), def main(): # check that we got a file passed to us if len(sys.argv) != 3 or not os.path.isfile(sys.argv[1]): print 'Must give a valid filename.' return # run tail function tail(sys.argv[1], sys.argv[2]) main() </code></pre> <p>This is the server you will run this on each computer that has a file you want to look at. Its nothing fancy. You can daemonize it if you want. You just run it, and you client should connect to it if you tell the client where it is and you have the right ports open. </p> <pre><code>#!/usr/bin/python # This runs on the computer(s) you want to read the file from # Make sure to change out the HOST and PORT variables HOST = 'localhost' PORT = 8000 from SimpleXMLRPCServer import SimpleXMLRPCServer from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler import time, os def GetSize(filename): # get file size return os.stat(filename)[6] def tail(filename, seek): #Set the filename and open the file f = open(filename,'r') #Find the size of the file and move to the end f.seek(seek) return f.read() def CreateServer(): # Create server server = SimpleXMLRPCServer((HOST, PORT), requestHandler=SimpleXMLRPCRequestHandler) # register functions server.register_function(tail, 'tail') server.register_function(GetSize, 'GetSize') # Run the server's main loop server.serve_forever() # start server CreateServer() </code></pre> <p>Ideally you run the server once, then from the client run "python client.py sample.log <a href="http://somehost:8000" rel="nofollow">http://somehost:8000</a>" and it should start going. Hope that helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload