Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IRC = require('irc-js')
- mongodb = require('mongodb')
- server = new mongodb.Server("autotest-db.cam.xci-test.com", 27017, {})
- irc_options =
- server: 'irc-int.xci-test.com'
- nick: 'autotestbot'
- flood_protection: true
- db = new mongodb.Db('logs', server, {})
- db.open (err, client) ->
- throw err if err
- client.collection 'logs', (err, logs) ->
- logs.find({}, {limit:1, sort: {$natural:-1}}).nextObject (err, doc1) ->
- throw err if err
- irc = new IRC irc_options
- irc.connect ->
- irc.join '#autotest'
- logs.find({_id:{$gt:doc1._id}}, {tailable:true, sort:{$natural:1}}).each (err, item) ->
- throw err if err
- if item.dut_name? and item.kind in ['HEADLINE', 'RESULT', 'CRASH']
- message = "#{item.dut_name} #{item.kind} #{item.message}"
- irc.privmsg "#autotest", message
- irc.on 'error:network', -> process.exit 1
- irc.on 'disconnected', -> process.exit 2
- irc.on 'error', -> process.exit 3
Add Comment
Please, Sign In to add comment