#!/usr/bin/python # Daemon for processing the Perforce Journal file as it is written to. import Journal, Setup, listener, cutil, p4util, types, os DEFAULT_REMOTE_CHECKPOINT_COUNTER = 'remote-checkpoint' def ConfigureLastCheckpoint(): ''' Configure the "lastCheckpoint" property in the Setup parameters. This value represents the last checkpoint the remote server was restored from. As it can be tricky to accurately represent in these scripts, you can alternatively default the value to None or a string, and the system will use the Perforce counter with that name (default is 'remote-checkpoint'). ''' lastcp = Setup.SERVER.lastCheckpoint if lastcp is None: lastcp = DEFAULT_REMOTE_CHECKPOINT_COUNTER if type(lastcp) in types.StringTypes: p4 = p4util.createP4() lastcp = p4.getCounter(lastcp) if lastcp is not None: Setup.lastCheckpoint = lastcp cutil.log(cutil.WARN, 'Using remote last checkpoint %d' % lastcp) if lastcp is None or type(lastcp) != types.IntType: cutil.log(cutil.FATAL, "Invalid last checkpoint value [%s]" % str(lastcp)) if __name__ == "__main__": cutil.log(cutil.WARN, "Starting daemon.") ConfigureLastCheckpoint() # started from the command-line try: poller = Journal.RotateJournal(Setup.SERVER.lastCheckpoint, Journal.TailJournalFile( Setup.SERVER.journal, os.path.join(Setup.SERVER.datadir, "journal-position"), True), Setup.SERVER.rotateJournal) loop = listener.ListenerRunner(poller, Setup.JOURNAL.listeners) loop.setupSignals() loop.loop(Setup.POLL_INTERVAL) except: cutil.log_error(cutil.FATAL) cutil.log(cutil.WARN, "Ending daemon.")
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 5850 | Matt Albrecht | Update logDaemon to version 1.5. | ||
#4 | 5810 | Matt Albrecht |
New version of logDaemon that has better bug fixes. Also added server-status web page for a pure client-side AJAX app that pulls together different server-side statistics. |
||
#3 | 5805 | Matt Albrecht | Update to version 1.3-alpha | ||
#2 | 5780 | Matt Albrecht | Update tool with lots of goodies | ||
#1 | 5424 | Matt Albrecht | Add a journal file daemon tool. |