I took a different approach and monitored the log output of svlogd, since I wanted the logs anyway. This is some code that well help you with that, anyway: import os import time import stat fIn = open("current", "r") sid = os.stat("current")[stat.ST_INO] while True: try: sidNew = os.stat("current")[stat.ST_INO] if sidNew != sid: fIn.close() fIn = open("current", "r") sid = sidNew except: time.sleep( 1 ) continue while True: l = fIn.readline() if l is None or l == '': break # do something interesting with your line here time.sleep( 1 ) This will read everything from current, and when current moves, it will read what's left, open the new current, and read all of it. I use it to monitor apache log output, and it hasn't failed me yet. --Mike On Thu, Sep 20, 2012 at 5:35 PM, Sergiusz Pawlowicz < sergiusz.pawlowicz@gmail.com> wrote: > Hi, > I am trying to write a python script which can be put in place of > svlogd/multilog, but I am stuck just at the beginning. > > The test script is pretty simple, it just forwards stdin to stdout: > > def main(): > > while True: > try: > line = raw_input() > print 'got', line > except EOFError: > print 'done' > pass > > if __name__ == '__main__': > main() > > It works, but not as desired, as the script is being restarted by runsv > constantly, it seems after it finishes reading stdin. Could you > please help me how can run that continuously listening to stdin? > > cheers, > Serge > -- > https://pawlowicz.name/ >